includes jinja templates in a documentation
Project description
.. image:: https://img.shields.io/travis/tardyp/sphinx-jinja.svg?maxAge=2592000
:target: https://travis-ci.org/tardyp/sphinx-jinja
sphinx-jinja
============
A sphinx extension to include jinja based templates based documentation into a sphinx doc
Usage
=====
In your rst doc, you can use the following snippet to use a jinja template to generate your doc
.. code:: rst
.. jinja:: first_ctx
{% for k, v in topics.items() %}
{{k}}
~~~~~
{{v}}
{% endfor %}
In your sphinx ``conf.py`` file, you can create or load the contexts needed for your jinja templates
::
extensions = ['sphinxcontrib.jinja']
jinja_contexts = {
'first_ctx': {'topics': {'a': 'b', 'c': 'd'}}
}
Available options
=================
- ``file``: allow to specify a path to Jinja instead of writing it into the content of the
directive. Path is relative to the current directory of sphinx-build tool, typically the directory
where the ``conf.py`` file is located.
- ``header_char``: character to use for the the headers. You can use it in your template to set your
own title character::
For example:
Title
{{ options.header_char * 5 }}
Example of declaration in your RST file:
.. code:: rst
.. jinja:: approval_checks_api
:file: relative/path/to/template.jinja
:header_char: -
Each element of the `jinja_contexts` dictionary is a context dict for use in your jinja templates.
Running tests
=============
* pip install tox
* tox
:target: https://travis-ci.org/tardyp/sphinx-jinja
sphinx-jinja
============
A sphinx extension to include jinja based templates based documentation into a sphinx doc
Usage
=====
In your rst doc, you can use the following snippet to use a jinja template to generate your doc
.. code:: rst
.. jinja:: first_ctx
{% for k, v in topics.items() %}
{{k}}
~~~~~
{{v}}
{% endfor %}
In your sphinx ``conf.py`` file, you can create or load the contexts needed for your jinja templates
::
extensions = ['sphinxcontrib.jinja']
jinja_contexts = {
'first_ctx': {'topics': {'a': 'b', 'c': 'd'}}
}
Available options
=================
- ``file``: allow to specify a path to Jinja instead of writing it into the content of the
directive. Path is relative to the current directory of sphinx-build tool, typically the directory
where the ``conf.py`` file is located.
- ``header_char``: character to use for the the headers. You can use it in your template to set your
own title character::
For example:
Title
{{ options.header_char * 5 }}
Example of declaration in your RST file:
.. code:: rst
.. jinja:: approval_checks_api
:file: relative/path/to/template.jinja
:header_char: -
Each element of the `jinja_contexts` dictionary is a context dict for use in your jinja templates.
Running tests
=============
* pip install tox
* tox
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.
See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for sphinx_jinja-0.2.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fecbd21e194c8d533e77ea881efb1dbaad299836feb6ea3edefe69fe21a4efa |
|
MD5 | e330bbb01d52f53cdd46861ab62bed0d |
|
BLAKE2b-256 | ba7f7fc80e2b513f39647e2f0969152ef89f23c7ffbab5b51055165abc4df1d3 |