@@ -26,6 +26,7 @@ The sources of Searx's documentation are located at :origin:`docs`. Run
2626 - `sphinx cross references`_
2727 - linuxdoc_
2828 - intersphinx_
29+ - sphinx-jinja_
2930 - `Sphinx's autodoc`_
3031 - `Sphinx's Python domain`_, `Sphinx's C domain`_
3132 - SVG_, ImageMagick_
@@ -1079,6 +1080,36 @@ Content of file ``csv_table.txt``:
10791080 :stub-columns: 1
10801081 :file: csv_table.txt
10811082
1083+Templating
1084+==========
1085+
1086+.. sidebar:: Build environment
1087+
1088+ All *generic-doc* tasks are running in the :ref:`build environment <make
1089+ pyenv>`.
1090+
1091+Templating is suitable for documentation which is created generic at the build
1092+time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`build
1093+environment <make pyenv>` with installed searx modules. We use this e.g. to
1094+build chapter: :ref:`engines generic`.
1095+
1096+Here is the content of the :origin:`docs/admin/engines.rst`:
1097+
1098+.. literalinclude:: ../admin/engines.rst
1099+ :language: reST
1100+ :start-after: .. _configured engines:
1101+
1102+The context for the template is selected in the line ``.. jinja:: webapp``. In
1103+sphinx's build configuration (:origin:`docs/conf.py`) the ``webapp`` context
1104+points to the name space of the python module: ``webapp``.
1105+
1106+.. code:: py
1107+
1108+ from searx import webapp
1109+ jinja_contexts = {
1110+ 'webapp': dict(**webapp.__dict__)
1111+ }
1112+
10821113
10831114
10841115.. _KISS: https://en.wikipedia.org/wiki/KISS_principle
@@ -1109,7 +1140,8 @@ Content of file ``csv_table.txt``:
11091140.. _docutils: http://docutils.sourceforge.net/docs/index.html
11101141.. _docutils FAQ: http://docutils.sourceforge.net/FAQ.html
11111142.. _linuxdoc: https://return42.github.io/linuxdoc
1112−
1143+.. _jinja: https://jinja.palletsprojects.com/
1144+.. _sphinx-jinja: https://github.com/tardyp/sphinx-jinja
11131145.. _SVG: https://www.w3.org/TR/SVG11/expanded-toc.html
11141146.. _DOT: https://graphviz.gitlab.io/_pages/doc/info/lang.html
11151147.. _`Graphviz's dot`: https://graphviz.gitlab.io/_pages/pdf/dotguide.pdf