conf.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # -*- coding: utf-8 -*-
  2. import sys, os
  3. from sphinx_build_tools import load_sphinx_config
  4. from searx.version import VERSION_STRING
  5. from pallets_sphinx_themes import ProjectLink
  6. from searx.brand import GIT_URL
  7. GIT_BRANCH = os.environ.get("GIT_BRANCH", "master")
  8. from searx.brand import SEARX_URL
  9. from searx.brand import DOCS_URL
  10. # Project --------------------------------------------------------------
  11. project = u'searx'
  12. copyright = u'2015-2020, Adam Tauber, Noémi Ványi'
  13. author = u'Adam Tauber'
  14. release, version = VERSION_STRING, VERSION_STRING
  15. highlight_language = 'none'
  16. # General --------------------------------------------------------------
  17. master_doc = "index"
  18. source_suffix = '.rst'
  19. numfig = True
  20. exclude_patterns = ['build-templates/*.rst']
  21. from searx import webapp
  22. from searx.engines import engines
  23. jinja_contexts = {
  24. 'webapp': dict(**webapp.__dict__),
  25. 'engines': engines
  26. }
  27. # usage:: lorem :patch:`f373169` ipsum
  28. extlinks = {}
  29. # upstream links
  30. extlinks['wiki'] = ('https://github.com/asciimoo/searx/wiki/%s', ' ')
  31. extlinks['pull'] = ('https://github.com/asciimoo/searx/pull/%s', 'PR ')
  32. # links to custom brand
  33. extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://')
  34. extlinks['patch'] = (GIT_URL + '/commit/%s', '#')
  35. extlinks['search'] = (SEARX_URL + '/%s', '#')
  36. extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ')
  37. extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ')
  38. extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '')
  39. #extlinks['role'] = (
  40. # 'https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-%s', '')
  41. extlinks['duref'] = (
  42. 'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#%s', '')
  43. extlinks['durole'] = (
  44. 'http://docutils.sourceforge.net/docs/ref/rst/roles.html#%s', '')
  45. extlinks['dudir'] = (
  46. 'http://docutils.sourceforge.net/docs/ref/rst/directives.html#%s', '')
  47. extlinks['ctan'] = (
  48. 'https://ctan.org/pkg/%s', 'CTAN: ')
  49. extensions = [
  50. 'sphinx.ext.imgmath',
  51. 'sphinx.ext.extlinks',
  52. 'sphinx.ext.viewcode',
  53. "sphinx.ext.autodoc",
  54. "sphinx.ext.intersphinx",
  55. "pallets_sphinx_themes",
  56. "sphinx_issues", # https://github.com/sloria/sphinx-issues/blob/master/README.rst
  57. "sphinxcontrib.jinja", # https://github.com/tardyp/sphinx-jinja
  58. "sphinxcontrib.programoutput", # https://github.com/NextThought/sphinxcontrib-programoutput
  59. 'linuxdoc.kernel_include', # Implementation of the 'kernel-include' reST-directive.
  60. 'linuxdoc.rstFlatTable', # Implementation of the 'flat-table' reST-directive.
  61. 'linuxdoc.kfigure', # Sphinx extension which implements scalable image handling.
  62. "sphinx_tabs.tabs", # https://github.com/djungelorm/sphinx-tabs
  63. ]
  64. intersphinx_mapping = {
  65. "python": ("https://docs.python.org/3/", None),
  66. "flask": ("https://flask.palletsprojects.com/", None),
  67. # "werkzeug": ("https://werkzeug.palletsprojects.com/", None),
  68. "jinja": ("https://jinja.palletsprojects.com/", None),
  69. "linuxdoc" : ("https://return42.github.io/linuxdoc/", None),
  70. "sphinx" : ("https://www.sphinx-doc.org/en/master/", None),
  71. }
  72. issues_github_path = "asciimoo/searx"
  73. # HTML -----------------------------------------------------------------
  74. sys.path.append(os.path.abspath('_themes'))
  75. html_theme_path = ['_themes']
  76. html_theme = "searx"
  77. # sphinx.ext.imgmath setup
  78. html_math_renderer = 'imgmath'
  79. imgmath_image_format = 'svg'
  80. imgmath_font_size = 14
  81. # sphinx.ext.imgmath setup END
  82. html_theme_options = {"index_sidebar_logo": True}
  83. html_context = {
  84. "project_links": [
  85. ProjectLink("Source", GIT_URL),
  86. ProjectLink("Wiki", "https://github.com/asciimoo/searx/wiki"),
  87. ProjectLink("Public instances", "https://searx.space/"),
  88. ProjectLink("Twitter", "https://twitter.com/Searx_engine"),
  89. ]
  90. }
  91. html_sidebars = {
  92. "**": ["project.html", "relations.html", "searchbox.html"],
  93. }
  94. singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}
  95. html_static_path = ["static"]
  96. html_logo = "static/img/searx_logo_small.png"
  97. html_title = "Searx Documentation ({})".format("Searx-{}.tex".format(VERSION_STRING))
  98. html_show_sourcelink = False
  99. # LaTeX ----------------------------------------------------------------
  100. latex_documents = [
  101. (master_doc, "searx-{}.tex".format(VERSION_STRING), html_title, author, "manual")
  102. ]
  103. # ------------------------------------------------------------------------------
  104. # Since loadConfig overwrites settings from the global namespace, it has to be
  105. # the last statement in the conf.py file
  106. # ------------------------------------------------------------------------------
  107. load_sphinx_config(globals())