conf.py 4.7 KB

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