conf.py 4.9 KB

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