on engine-data help sign in
searx/docs/conf.py
136 lines 5.1 kB history raw
1# -*- coding: utf-8 -*-
3import sys, os
4from sphinx_build_tools import load_sphinx_config
5from pallets_sphinx_themes import ProjectLink
7from searx import brand
8from searx.version import VERSION_STRING
10# Project --------------------------------------------------------------
12project = u'searx'
13copyright = u'2015-2020, Adam Tauber, Noémi Ványi'
14author = u'Adam Tauber'
15release, version = VERSION_STRING, VERSION_STRING
16highlight_language = 'none'
18# General --------------------------------------------------------------
20master_doc = "index"
21source_suffix = '.rst'
22numfig = True
24exclude_patterns = ['build-templates/*.rst']
26import searx.search
27import searx.engines
28import searx.plugins
29searx.search.initialize()
30jinja_contexts = {
31 'searx': {
32 'engines': searx.engines.engines,
33 'plugins': searx.plugins.plugins
34 },
37# usage:: lorem :patch:`f373169` ipsum
38extlinks = {}
40# upstream links
41extlinks['wiki'] = ('https://github.com/searx/searx/wiki/%s', ' ')
42extlinks['pull'] = ('https://github.com/searx/searx/pull/%s', 'PR ')
44# links to custom brand
45extlinks['origin'] = (brand.GIT_URL + '/blob/' + brand.GIT_BRANCH + '/%s', 'git://')
46extlinks['patch'] = (brand.GIT_URL + '/commit/%s', '#')
47extlinks['search'] = (brand.SEARX_URL + '/%s', '#')
48extlinks['docs'] = (brand.DOCS_URL + '/%s', 'docs: ')
49extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ')
50extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '')
51#extlinks['role'] = (
52# 'https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-%s', '')
53extlinks['duref'] = (
54 'https://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#%s', '')
55extlinks['durole'] = (
56 'https://docutils.sourceforge.net/docs/ref/rst/roles.html#%s', '')
57extlinks['dudir'] = (
58 'https://docutils.sourceforge.net/docs/ref/rst/directives.html#%s', '')
59extlinks['ctan'] = (
60 'https://ctan.org/pkg/%s', 'CTAN: ')
62extensions = [
63 'sphinx.ext.imgmath',
64 'sphinx.ext.extlinks',
65 'sphinx.ext.viewcode',
66 "sphinx.ext.autodoc",
67 "sphinx.ext.intersphinx",
68 "pallets_sphinx_themes",
69 "sphinx_issues", # https://github.com/sloria/sphinx-issues/blob/master/README.rst
70 "sphinxcontrib.jinja", # https://github.com/tardyp/sphinx-jinja
71 "sphinxcontrib.programoutput", # https://github.com/NextThought/sphinxcontrib-programoutput
72 'linuxdoc.kernel_include', # Implementation of the 'kernel-include' reST-directive.
73 'linuxdoc.rstFlatTable', # Implementation of the 'flat-table' reST-directive.
74 'linuxdoc.kfigure', # Sphinx extension which implements scalable image handling.
75 "sphinx_tabs.tabs", # https://github.com/djungelorm/sphinx-tabs
78intersphinx_mapping = {
79 "python": ("https://docs.python.org/3/", None),
80 "flask": ("https://flask.palletsprojects.com/", None),
81 # "werkzeug": ("https://werkzeug.palletsprojects.com/", None),
82 "jinja": ("https://jinja.palletsprojects.com/", None),
83 "linuxdoc" : ("https://return42.github.io/linuxdoc/", None),
84 "sphinx" : ("https://www.sphinx-doc.org/en/master/", None),
87issues_github_path = "searx/searx"
89# HTML -----------------------------------------------------------------
91sys.path.append(os.path.abspath('_themes'))
92sys.path.insert(0, os.path.abspath("../utils/"))
93html_theme_path = ['_themes']
94html_theme = "searx"
96# sphinx.ext.imgmath setup
97html_math_renderer = 'imgmath'
98imgmath_image_format = 'svg'
99imgmath_font_size = 14
100# sphinx.ext.imgmath setup END
102html_theme_options = {"index_sidebar_logo": True}
103html_context = {"project_links": [] }
104if brand.GIT_URL:
105 html_context["project_links"].append(ProjectLink("Source", brand.GIT_URL))
106if brand.WIKI_URL:
107 html_context["project_links"].append(ProjectLink("Wiki", brand.WIKI_URL))
108if brand.PUBLIC_INSTANCES:
109 html_context["project_links"].append(ProjectLink("Public instances", brand.PUBLIC_INSTANCES))
110if brand.TWITTER_URL:
111 html_context["project_links"].append(ProjectLink("Twitter", brand.TWITTER_URL))
112if brand.ISSUE_URL:
113 html_context["project_links"].append(ProjectLink("Issue Tracker", brand.ISSUE_URL))
114if brand.CONTACT_URL:
115 html_context["project_links"].append(ProjectLink("Contact", brand.CONTACT_URL))
117html_sidebars = {
118 "**": ["project.html", "relations.html", "searchbox.html"],
120singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}
121html_static_path = ["static"]
122html_logo = "static/img/searx_logo_small.png"
123html_title = "Searx Documentation ({})".format("Searx-{}.tex".format(VERSION_STRING))
124html_show_sourcelink = False
126# LaTeX ----------------------------------------------------------------
128latex_documents = [
129 (master_doc, "searx-{}.tex".format(VERSION_STRING), html_title, author, "manual")
132# ------------------------------------------------------------------------------
133# Since loadConfig overwrites settings from the global namespace, it has to be
134# the last statement in the conf.py file
135# ------------------------------------------------------------------------------
136load_sphinx_config(globals())