| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | # -*- coding: utf-8 -*- | 
					
						
							| 
									
										
										
										
											2021-04-17 18:20:29 +02:00
										 |  |  | # SPDX-License-Identifier: AGPL-3.0-or-later | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | import  sys, os | 
					
						
							|  |  |  | from pallets_sphinx_themes import ProjectLink | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-17 19:03:54 +02:00
										 |  |  | from searx import get_setting | 
					
						
							| 
									
										
										
										
											2021-07-27 18:37:46 +02:00
										 |  |  | from searx.version import VERSION_STRING, GIT_URL, GIT_BRANCH | 
					
						
							| 
									
										
										
										
											2020-09-29 12:30:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | # Project -------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-10 11:49:57 +02:00
										 |  |  | project = 'SearXNG' | 
					
						
							| 
									
										
										
										
											2023-07-29 09:02:07 +02:00
										 |  |  | copyright = 'SearXNG team' | 
					
						
							|  |  |  | author = 'SearXNG team' | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | release, version = VERSION_STRING, VERSION_STRING | 
					
						
							| 
									
										
										
										
											2021-06-01 15:09:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-11 19:59:34 +02:00
										 |  |  | SEARXNG_URL = get_setting('server.base_url') or 'https://example.org/searxng' | 
					
						
							| 
									
										
										
										
											2021-07-17 19:03:54 +02:00
										 |  |  | ISSUE_URL = get_setting('brand.issue_url') | 
					
						
							|  |  |  | DOCS_URL = get_setting('brand.docs_url') | 
					
						
							|  |  |  | PUBLIC_INSTANCES = get_setting('brand.public_instances') | 
					
						
							| 
									
										
										
										
											2022-06-15 22:06:52 +02:00
										 |  |  | PRIVACYPOLICY_URL = get_setting('general.privacypolicy_url') | 
					
						
							| 
									
										
										
										
											2021-07-17 19:03:54 +02:00
										 |  |  | CONTACT_URL = get_setting('general.contact_url') | 
					
						
							|  |  |  | WIKI_URL = get_setting('brand.wiki_url') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-01 15:09:24 +02:00
										 |  |  | # hint: sphinx.ext.viewcode won't highlight when 'highlight_language' [1] is set | 
					
						
							|  |  |  | #       to string 'none' [2] | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # [1] https://www.sphinx-doc.org/en/master/usage/extensions/viewcode.html | 
					
						
							|  |  |  | # [2] https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-highlight_language | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | highlight_language = 'default' | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | # General -------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | master_doc = "index" | 
					
						
							|  |  |  | source_suffix = '.rst' | 
					
						
							| 
									
										
										
										
											2019-12-19 23:36:53 +01:00
										 |  |  | numfig = True | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 10:18:08 +01:00
										 |  |  | exclude_patterns = ['build-templates/*.rst', 'user/*.md'] | 
					
						
							| 
									
										
										
										
											2020-03-03 16:26:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-21 09:53:41 +01:00
										 |  |  | import searx.engines | 
					
						
							|  |  |  | import searx.plugins | 
					
						
							| 
									
										
										
										
											2022-01-03 07:24:20 +01:00
										 |  |  | import searx.webutils | 
					
						
							| 
									
										
										
										
											2022-01-07 17:03:49 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-26 23:02:45 +01:00
										 |  |  | # import searx.webapp is needed to init the engines & plugins, to init a | 
					
						
							|  |  |  | # (empty) secret_key is needed. | 
					
						
							| 
									
										
										
										
											2022-01-07 17:03:49 +01:00
										 |  |  | searx.settings['server']['secret_key'] = '' | 
					
						
							| 
									
										
										
										
											2022-01-26 23:02:45 +01:00
										 |  |  | import searx.webapp | 
					
						
							| 
									
										
										
										
											2022-01-07 17:03:49 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-04 11:26:37 +02:00
										 |  |  | searx.engines.load_engines(searx.settings['engines']) | 
					
						
							| 
									
										
										
										
											2021-12-28 12:51:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-21 17:13:38 +01:00
										 |  |  | jinja_contexts = { | 
					
						
							| 
									
										
										
										
											2020-12-21 09:53:41 +01:00
										 |  |  |     'searx': { | 
					
						
							|  |  |  |         'engines': searx.engines.engines, | 
					
						
							| 
									
										
										
										
											2021-11-14 18:10:14 +01:00
										 |  |  |         'plugins': searx.plugins.plugins, | 
					
						
							|  |  |  |         'version': { | 
					
						
							|  |  |  |             'node': os.getenv('NODE_MINIMUM_VERSION') | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2021-12-21 12:54:01 +01:00
										 |  |  |         'enabled_engine_count': sum(not x.disabled for x in searx.engines.engines.values()), | 
					
						
							| 
									
										
										
										
											2021-12-28 12:51:29 +01:00
										 |  |  |         'categories': searx.engines.categories, | 
					
						
							| 
									
										
										
										
											2021-12-22 15:51:26 +01:00
										 |  |  |         'categories_as_tabs': {c: searx.engines.categories[c] for c in searx.settings['categories_as_tabs']}, | 
					
						
							| 
									
										
										
										
											2020-12-21 09:53:41 +01:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-12-21 17:13:38 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-12-20 23:57:06 +01:00
										 |  |  | jinja_filters = { | 
					
						
							| 
									
										
										
										
											2022-01-03 07:24:20 +01:00
										 |  |  |     'group_engines_in_tab': searx.webutils.group_engines_in_tab, | 
					
						
							| 
									
										
										
										
											2021-12-20 23:57:06 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-21 17:13:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-21 17:44:05 +01:00
										 |  |  | # Let the Jinja template in configured_engines.rst access documented_modules | 
					
						
							|  |  |  | # to automatically link documentation for modules if it exists. | 
					
						
							|  |  |  | def setup(app): | 
					
						
							| 
									
										
										
										
											2023-04-16 14:23:27 +02:00
										 |  |  |     ENGINES_DOCNAME = 'user/configured_engines' | 
					
						
							| 
									
										
										
										
											2021-12-21 17:44:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def before_read_docs(app, env, docnames): | 
					
						
							|  |  |  |         assert ENGINES_DOCNAME in docnames | 
					
						
							|  |  |  |         docnames.remove(ENGINES_DOCNAME) | 
					
						
							|  |  |  |         docnames.append(ENGINES_DOCNAME) | 
					
						
							|  |  |  |         # configured_engines must come last so that sphinx already has | 
					
						
							|  |  |  |         # discovered the python module documentations | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def source_read(app, docname, source): | 
					
						
							|  |  |  |         if docname == ENGINES_DOCNAME: | 
					
						
							|  |  |  |             jinja_contexts['searx']['documented_modules'] = app.env.domains['py'].modules | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     app.connect('env-before-read-docs', before_read_docs) | 
					
						
							|  |  |  |     app.connect('source-read', source_read) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 16:48:36 +01:00
										 |  |  | # usage::   lorem :patch:`f373169` ipsum | 
					
						
							|  |  |  | extlinks = {} | 
					
						
							| 
									
										
										
										
											2019-12-12 19:20:56 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # upstream links | 
					
						
							| 
									
										
										
										
											2022-07-05 17:10:19 +02:00
										 |  |  | extlinks['wiki'] = ('https://github.com/searxng/searxng/wiki/%s', ' %s') | 
					
						
							|  |  |  | extlinks['pull'] = ('https://github.com/searxng/searxng/pull/%s', 'PR %s') | 
					
						
							|  |  |  | extlinks['pull-searx'] = ('https://github.com/searx/searx/pull/%s', 'PR %s') | 
					
						
							| 
									
										
										
										
											2019-12-12 19:20:56 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # links to custom brand | 
					
						
							| 
									
										
										
										
											2022-07-05 17:10:19 +02:00
										 |  |  | extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://%s') | 
					
						
							|  |  |  | extlinks['patch'] = (GIT_URL + '/commit/%s', '#%s') | 
					
						
							|  |  |  | extlinks['docs'] = (DOCS_URL + '/%s', 'docs: %s') | 
					
						
							|  |  |  | extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: %s') | 
					
						
							|  |  |  | extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '%s') | 
					
						
							| 
									
										
										
										
											2019-12-19 23:36:53 +01:00
										 |  |  | #extlinks['role'] = ( | 
					
						
							|  |  |  | #    'https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-%s', '') | 
					
						
							| 
									
										
										
										
											2019-12-19 17:05:50 +01:00
										 |  |  | extlinks['duref'] = ( | 
					
						
							| 
									
										
										
										
											2022-07-05 17:10:19 +02:00
										 |  |  |     'https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#%s', '%s') | 
					
						
							| 
									
										
										
										
											2019-12-19 17:05:50 +01:00
										 |  |  | extlinks['durole'] = ( | 
					
						
							| 
									
										
										
										
											2022-07-05 17:10:19 +02:00
										 |  |  |     'https://docutils.sourceforge.io/docs/ref/rst/roles.html#%s', '%s') | 
					
						
							| 
									
										
										
										
											2019-12-19 17:05:50 +01:00
										 |  |  | extlinks['dudir'] =  ( | 
					
						
							| 
									
										
										
										
											2022-07-05 17:10:19 +02:00
										 |  |  |     'https://docutils.sourceforge.io/docs/ref/rst/directives.html#%s', '%s') | 
					
						
							| 
									
										
										
										
											2019-12-28 01:01:11 +01:00
										 |  |  | extlinks['ctan'] =  ( | 
					
						
							| 
									
										
										
										
											2022-07-05 17:10:19 +02:00
										 |  |  |     'https://ctan.org/pkg/%s', 'CTAN: %s') | 
					
						
							| 
									
										
										
										
											2019-12-04 16:48:36 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | extensions = [ | 
					
						
							| 
									
										
										
										
											2019-12-28 01:25:16 +01:00
										 |  |  |     'sphinx.ext.imgmath', | 
					
						
							| 
									
										
										
										
											2019-12-04 16:48:36 +01:00
										 |  |  |     'sphinx.ext.extlinks', | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  |     'sphinx.ext.viewcode', | 
					
						
							|  |  |  |     "sphinx.ext.autodoc", | 
					
						
							|  |  |  |     "sphinx.ext.intersphinx", | 
					
						
							|  |  |  |     "pallets_sphinx_themes", | 
					
						
							|  |  |  |     "sphinx_issues", # https://github.com/sloria/sphinx-issues/blob/master/README.rst | 
					
						
							| 
									
										
										
										
											2022-03-12 10:54:30 +01:00
										 |  |  |     "sphinx_jinja",  # https://github.com/tardyp/sphinx-jinja | 
					
						
							| 
									
										
										
										
											2020-01-11 12:49:02 +01:00
										 |  |  |     "sphinxcontrib.programoutput",  # https://github.com/NextThought/sphinxcontrib-programoutput | 
					
						
							| 
									
										
										
										
											2020-06-18 18:51:31 +02:00
										 |  |  |     'linuxdoc.kernel_include',  # Implementation of the 'kernel-include' reST-directive. | 
					
						
							| 
									
										
										
										
											2019-12-19 23:36:53 +01:00
										 |  |  |     'linuxdoc.rstFlatTable',    # Implementation of the 'flat-table' reST-directive. | 
					
						
							|  |  |  |     'linuxdoc.kfigure',         # Sphinx extension which implements scalable image handling. | 
					
						
							| 
									
										
										
										
											2019-12-26 10:26:12 +01:00
										 |  |  |     "sphinx_tabs.tabs", # https://github.com/djungelorm/sphinx-tabs | 
					
						
							| 
									
										
										
										
											2022-03-12 10:18:08 +01:00
										 |  |  |     'myst_parser',  # https://www.sphinx-doc.org/en/master/usage/markdown.html | 
					
						
							| 
									
										
										
										
											2022-03-21 22:02:51 +01:00
										 |  |  |     'notfound.extension',  # https://github.com/readthedocs/sphinx-notfound-page | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | ] | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-29 20:54:46 +02:00
										 |  |  | autodoc_default_options = { | 
					
						
							|  |  |  |     'member-order': 'groupwise', | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-06 15:49:50 +02:00
										 |  |  | myst_enable_extensions = [ | 
					
						
							|  |  |  |   "replacements", "smartquotes" | 
					
						
							|  |  |  | ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 10:18:08 +01:00
										 |  |  | suppress_warnings = ['myst.domains'] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | intersphinx_mapping = { | 
					
						
							|  |  |  |     "python": ("https://docs.python.org/3/", None), | 
					
						
							| 
									
										
										
										
											2022-09-29 20:54:46 +02:00
										 |  |  |     "babel" : ("https://babel.readthedocs.io/en/latest/", None), | 
					
						
							| 
									
										
										
										
											2019-12-19 17:05:50 +01:00
										 |  |  |     "flask": ("https://flask.palletsprojects.com/", None), | 
					
						
							| 
									
										
										
										
											2022-06-22 09:22:21 +02:00
										 |  |  |     "flask_babel": ("https://python-babel.github.io/flask-babel/", None), | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  |     # "werkzeug": ("https://werkzeug.palletsprojects.com/", None), | 
					
						
							| 
									
										
										
										
											2019-12-19 17:05:50 +01:00
										 |  |  |     "jinja": ("https://jinja.palletsprojects.com/", None), | 
					
						
							| 
									
										
										
										
											2019-12-19 23:36:53 +01:00
										 |  |  |     "linuxdoc" : ("https://return42.github.io/linuxdoc/", None), | 
					
						
							|  |  |  |     "sphinx" : ("https://www.sphinx-doc.org/en/master/", None), | 
					
						
							| 
									
										
										
										
											2022-03-30 20:21:37 +02:00
										 |  |  |     "redis": ('https://redis.readthedocs.io/en/stable/', None), | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-25 12:03:54 +02:00
										 |  |  | issues_github_path = "searxng/searxng" | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | # HTML ----------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 22:02:51 +01:00
										 |  |  | # https://searxng.github.io/searxng --> '/searxng/' | 
					
						
							|  |  |  | # https://docs.searxng.org --> '/' | 
					
						
							|  |  |  | notfound_urls_prefix = '/' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | sys.path.append(os.path.abspath('_themes')) | 
					
						
							| 
									
										
										
										
											2020-11-04 13:38:54 +01:00
										 |  |  | sys.path.insert(0, os.path.abspath("../utils/")) | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | html_theme_path = ['_themes'] | 
					
						
							| 
									
										
										
										
											2021-11-18 17:33:48 +01:00
										 |  |  | html_theme = "searxng" | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-28 01:25:16 +01:00
										 |  |  | # sphinx.ext.imgmath setup | 
					
						
							|  |  |  | html_math_renderer = 'imgmath' | 
					
						
							|  |  |  | imgmath_image_format = 'svg' | 
					
						
							|  |  |  | imgmath_font_size = 14 | 
					
						
							|  |  |  | # sphinx.ext.imgmath setup END | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 09:02:07 +02:00
										 |  |  | html_show_sphinx = False | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | html_theme_options = {"index_sidebar_logo": True} | 
					
						
							| 
									
										
										
										
											2020-12-21 00:37:45 +01:00
										 |  |  | html_context = {"project_links": [] } | 
					
						
							| 
									
										
										
										
											2021-07-17 19:03:54 +02:00
										 |  |  | html_context["project_links"].append(ProjectLink("Source", GIT_URL + '/tree/' + GIT_BRANCH)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if WIKI_URL: | 
					
						
							|  |  |  |     html_context["project_links"].append(ProjectLink("Wiki", WIKI_URL)) | 
					
						
							|  |  |  | if PUBLIC_INSTANCES: | 
					
						
							|  |  |  |     html_context["project_links"].append(ProjectLink("Public instances", PUBLIC_INSTANCES)) | 
					
						
							|  |  |  | if ISSUE_URL: | 
					
						
							|  |  |  |     html_context["project_links"].append(ProjectLink("Issue Tracker", ISSUE_URL)) | 
					
						
							| 
									
										
										
										
											2022-06-15 22:06:52 +02:00
										 |  |  | if PRIVACYPOLICY_URL: | 
					
						
							|  |  |  |     html_context["project_links"].append(ProjectLink("Privacy Policy", PRIVACYPOLICY_URL)) | 
					
						
							| 
									
										
										
										
											2021-07-17 19:03:54 +02:00
										 |  |  | if CONTACT_URL: | 
					
						
							|  |  |  |     html_context["project_links"].append(ProjectLink("Contact", CONTACT_URL)) | 
					
						
							| 
									
										
										
										
											2020-12-21 00:37:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | html_sidebars = { | 
					
						
							| 
									
										
										
										
											2021-12-23 19:39:29 +01:00
										 |  |  |     "**": [ | 
					
						
							|  |  |  |         "globaltoc.html", | 
					
						
							|  |  |  |         "project.html", | 
					
						
							|  |  |  |         "relations.html", | 
					
						
							|  |  |  |         "searchbox.html", | 
					
						
							|  |  |  |         "sourcelink.html" | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]} | 
					
						
							| 
									
										
										
										
											2021-11-29 19:38:23 +01:00
										 |  |  | html_logo = "../src/brand/searxng-wordmark.svg" | 
					
						
							| 
									
										
										
										
											2021-09-12 08:36:56 +02:00
										 |  |  | html_title = "SearXNG Documentation ({})".format(VERSION_STRING) | 
					
						
							| 
									
										
										
										
											2021-11-18 17:27:49 +01:00
										 |  |  | html_show_sourcelink = True | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | # LaTeX ---------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 15:27:27 +01:00
										 |  |  | latex_documents = [ | 
					
						
							| 
									
										
										
										
											2022-06-14 10:02:50 +02:00
										 |  |  |     (master_doc, "searxng-{}.tex".format(VERSION_STRING), html_title, author, "manual") | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | ] |