Skip to main content
Author:

Hartmut Goebel <h.goebel@crazy-compilers.com>

Licence:

GNU General Public Licence v3 or later (GPLv3+)

This tool allows you writing documentation directly into jinja2 template-files as comments. These comments will then be converted to text and the template-code goes into literal blocks.

This is some kind of literate programming, except that you do not write code into your text, but text into your code. This difference allows to use the template-file directly without any pre-processing.

Usage:

jinja2rst [-h] infile outfile

positional arguments:
  infile      jinja2-template-file to read (`-` for stdin)
  outfile     rst-file to write (`-` for stdout)

optional arguments:
  -h, --help  show this help message and exit

How it works

This script takes all lines beginning with # (and lines consisting of only a #) as text-lines. Everything else will be treated as “code”. The text-lines will get the # removed and the “code” will get spaces prepended.

Additionally at the start and at the end of a “code”-block, lines are added as required by reStructuredText. Also at the begin of a “code”-block, a :: is added if required.

Examples

You can find example jinja2-input, rst-output and generated html in the examples directory. You may also view the generated html online at https://rawgit.com/htgoebel/jinja2rst/develop/examples/main.html.

Metadata

Release files for jinja2rst 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jinja2rst 0.1
File Size Uploaded
jinja2rst-0.1.tar.gz 21.0 kB Details

Release files / jinja2rst-0.1.tar.gz

Download URL jinja2rst-0.1.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f3e2927c1816aa7099c14dbc6aae97a5bcdc49649c30e0223b8b8ee1d8b67983
BLAKE2b-256 checksum
How to use checksums
9310e7790e6a28cd8d81fc2341ca37066791a9e7c84cfd0330c238da0b468c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page