Use proper jinja templating inside rst templates

master
kaiyou 7 years ago
parent 30a1657155
commit 49bfeda3d3

@ -19,17 +19,17 @@ Docker Compose configuration is stored in a file named
:download:`docker-compose.yml`. Additionally, Mailu
relies on a :download:`.env` file for various settings. Download
the proper template files from the git repository. To download the configuration
for the ":var:`github_version`" branch, use:
for the ``{{ github_version }}`` branch, use:
.. parsed-literal::
.. code-block:: bash
wget https://mailu.io/:var:`github_version`/_downloads/docker-compose.yml
wget https://mailu.io/:var:`github_version`/_downloads/.env
wget https://mailu.io/{{ github_version }}/_downloads/docker-compose.yml
wget https://mailu.io/{{ github_version }}/_downloads/.env
Then open the ``.env`` file to setup the mail server. Modify the ``ROOT`` setting
to match your setup directory if different from ``/mailu``.
Mdify the ``VERSION`` configuration in the ``.env`` file to reflect the version you picked..
Mdify the ``VERSION`` configuration in the ``.env`` file to reflect the version you picked.
Set the common configuration values
-----------------------------------

@ -41,12 +41,17 @@ html_context = {
def setup(app):
""" The configuration acts as an extension itself.
""" The conf itself is an extension for parsing rst.
"""
def var_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
return [docutils.nodes.Text(html_context.get(text, ""))], []
def rstjinja(app, docname, source):
""" Render our pages as a jinja template for fancy templating.
"""
if app.builder.format != 'html':
return
source[0] = app.builder.templates.render_string(
source[0], app.config.html_context)
app.add_role("var", var_role)
app.connect("source-read", rstjinja)
# Upload function when the script is called directly

@ -26,7 +26,7 @@ for trust in a specific branch of the project, we can switch to a shared
repository and add a couple of trusted committers.
Commits
``````
```````
This is a community project, thus commits should be readable enough for any of
the contributors to guess the content by simply reading the comment or find a

Loading…
Cancel
Save