conf.py 4.7 KB

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