summaryrefslogtreecommitdiff
path: root/docs/conf.py
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-12-21 17:44:05 +0100
committerMartin Fischer <martin@push-f.com>2021-12-21 21:06:17 +0100
commitca7f1a2da6e09a81a8823b1f146b186132ef0e92 (patch)
treed71b96230e3a0e2c9e7de87d84398684a7a20d3f /docs/conf.py
parent42d70e15ad2932069aca9434ca3831cc6f210aa0 (diff)
downloadsearxng-ca7f1a2da6e09a81a8823b1f146b186132ef0e92.tar.gz
searxng-ca7f1a2da6e09a81a8823b1f146b186132ef0e92.zip
[doc] engine-table: link module documentation if it exists
Diffstat (limited to 'docs/conf.py')
-rw-r--r--docs/conf.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py
index a319762e2..560e3daf8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -58,6 +58,25 @@ jinja_filters = {
)
}
+# Let the Jinja template in configured_engines.rst access documented_modules
+# to automatically link documentation for modules if it exists.
+def setup(app):
+ ENGINES_DOCNAME = 'admin/engines/configured_engines'
+
+ 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)
+
# usage:: lorem :patch:`f373169` ipsum
extlinks = {}