From 5831221c0e3ffcc326e28df8d304c31e3e27580b Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 6 Nov 2017 13:24:40 +0100 Subject: [PATCH] Use a template to replace the version tag --- docs/_templates/page.html | 4 ++++ docs/compose/setup.rst | 6 +++--- docs/conf.py | 19 +------------------ 3 files changed, 8 insertions(+), 21 deletions(-) create mode 100644 docs/_templates/page.html diff --git a/docs/_templates/page.html b/docs/_templates/page.html new file mode 100644 index 00000000..97296793 --- /dev/null +++ b/docs/_templates/page.html @@ -0,0 +1,4 @@ +{%- extends "layout.html" %} +{% block body %} + {{ body|replace("VERSION_TAG", version) }} +{% endblock %} diff --git a/docs/compose/setup.rst b/docs/compose/setup.rst index 4dded51e..8870613c 100644 --- a/docs/compose/setup.rst +++ b/docs/compose/setup.rst @@ -19,12 +19,12 @@ 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 ``{{ github_version }}`` branch, use: +for the ``VERSION_TAG`` branch, use: .. code-block:: bash - wget https://mailu.io/{{ github_version }}/_downloads/docker-compose.yml - wget https://mailu.io/{{ github_version }}/_downloads/.env + wget https://mailu.io/VERSION_TAG/_downloads/docker-compose.yml + wget https://mailu.io/VERSION_TAG/_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``. diff --git a/docs/conf.py b/docs/conf.py index 276d2260..3c522f20 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,10 +2,7 @@ # -*- coding: utf-8 -*- # -import os, sys, docutils - -sys.path.append(os.path.dirname(__file__)) -extensions = ['sphinx.ext.imgmath', 'sphinx.ext.viewcode', 'conf'] +extensions = ['sphinx.ext.imgmath', 'sphinx.ext.viewcode'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' @@ -40,20 +37,6 @@ html_context = { } -def setup(app): - """ The conf itself is an extension for parsing rst. - """ - 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.connect("source-read", rstjinja) - - # Upload function when the script is called directly if __name__ == "__main__": import os, sys, paramiko