Skip to content

Commit

Permalink
[mod] documentation: change the jinja context doesn't depend on searx…
Browse files Browse the repository at this point in the history
….webapp

Before this commit, in the documentation, the jinja context is 'webapp' and contains
the global variable in the searx.webapp module.

This commit changes this to include only the mandatory variables to build the
documentation.
  • Loading branch information
dalf committed Dec 27, 2020
1 parent 1ba53e6 commit eb1b528
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/admin/engines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Show errors **DE**

.. _configured engines:

.. jinja:: webapp
.. jinja:: searx

.. flat-table:: Engines configured at built time (defaults)
:header-rows: 1
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Configuration defaults (at built time):

.. _configured plugins:

.. jinja:: webapp
.. jinja:: searx

.. flat-table:: Plugins configured at built time (defaults)
:header-rows: 1
Expand Down
10 changes: 8 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@

exclude_patterns = ['build-templates/*.rst']

from searx import webapp
import searx.search
import searx.engines
import searx.plugins
searx.search.initialize()
jinja_contexts = {
'webapp': dict(**webapp.__dict__),
'searx': {
'engines': searx.engines.engines,
'plugins': searx.plugins.plugins
},
}

# usage:: lorem :patch:`f373169` ipsum
Expand Down
16 changes: 11 additions & 5 deletions docs/dev/reST.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1289,15 +1289,21 @@ build chapter: :ref:`engines generic`. Below the jinja directive from the
:language: reST
:start-after: .. _configured engines:

The context for the template is selected in the line ``.. jinja:: webapp``. In
sphinx's build configuration (:origin:`docs/conf.py`) the ``webapp`` context
points to the name space of the python module: ``webapp``.
The context for the template is selected in the line ``.. jinja:: searx``. In
sphinx's build configuration (:origin:`docs/conf.py`) the ``searx`` context
contains the ``engines`` and ``plugins``.

.. code:: py
from searx import webapp
import searx.search
import searx.engines
import searx.plugins
searx.search.initialize()
jinja_contexts = {
'webapp': dict(**webapp.__dict__)
'searx': {
'engines': searx.engines.engines,
'plugins': searx.plugins.plugins
},
}
Expand Down

0 comments on commit eb1b528

Please sign in to comment.