conf.py 4.5 KB

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