Skip to main content

A Simple Tool for Documenting YAML Files

Project description

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 YAML-files as comments. These comments will then be converted to text and the YAML-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 process the YAML file directly without any pre-processing.

Usage:

yaml2rst [-h] [--strip-regex regex] infile outfile

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

optional arguments:
  -h, --help           show this help message and exit
  --strip-regex regex  Regex which will remove everything it matches. Can be
                       used to remove fold markers from headings for example.
                       Example to strip out [[[,]]] fold markers:
                       '\s*(:?\[{3}|\]{3})\d?$'. Check the README for more
                       details.

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.

--strip-regex can be used to remove matching characters from text-lines when needed. Refer to documentation about Folding marks support for details.

Examples

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

Maintainers

yaml2rst was originally developed 2015 and maintained by Hartmut Goebel. In 2019 the project moved to the debops project for which yaml2rst was developed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yaml2rst-0.3.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

yaml2rst-0.3-py2.py3-none-any.whl (8.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file yaml2rst-0.3.tar.gz.

File metadata

  • Download URL: yaml2rst-0.3.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15

File hashes

Hashes for yaml2rst-0.3.tar.gz
Algorithm Hash digest
SHA256 b517836b5d84d76b5b479ea8ba59bddef3f7bbe3bbb8ba770334b2dd2856b28b
MD5 ccbefec2037523764216b706f7379c19
BLAKE2b-256 de881685f29d0627ec24bb0ccf790a4f1d0d276a4949db4288835163bd9b8c66

See more details on using hashes here.

File details

Details for the file yaml2rst-0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: yaml2rst-0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15

File hashes

Hashes for yaml2rst-0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e563869fb1797ab3c560bca2d916b50b5df49003a22e2f77b5ec2b1c37430d54
MD5 3049d5ff40f229563bd59c97ba223f14
BLAKE2b-256 93af1720183746de57e8a9dba661e65afc8afe0fc490fc7a8cd044f7cd3cf3c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page