conf.py 5.0 KB

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