Sphinx extension for rendering data files as nice HTML
Project description
This package contains sphinxcontrb.datatemplates, an extension for Sphinx to render parts of reStructuredText pages from data files in formats like JSON, YAML, and CSV.
Sample YAML Input
--- key1: value1 key2: - list item 1 - list item 2 - list item 3 nested-list: - ['a', 'b', 'c'] - ['A', 'B', 'C'] mapping-series: - cola: a colb: b colc: c - cola: A colb: B colc: C
Sample Template
.. -*- mode: rst -*- Individual Item ~~~~~~~~~~~~~~~ {{ data['key1'] }} List of Items ~~~~~~~~~~~~~ {% for item in data['key2'] %} - {{item}} {% endfor %} Nested List Table ~~~~~~~~~~~~~~~~~ Rendering a table from a list of nested sequences using hard-coded headers. {{ make_list_table( ['One', 'Two', 'Three'], data['nested-list'], title='Table from nested lists', ) }} Mapping Series Table ~~~~~~~~~~~~~~~~~~~~ Rendering a table from a list of nested dictionaries using dynamic headers. {{ make_list_table_from_mappings( [('One', 'cola'), ('Two', 'colb'), ('Three', 'colc')], data['mapping-series'], title='Table from series of mappings', ) }}
Rendered Output
See the sphinx output online.
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 Distribution
Built Distribution
File details
Details for the file sphinxcontrib.datatemplates-0.6.1.tar.gz
.
File metadata
- Download URL: sphinxcontrib.datatemplates-0.6.1.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6a8ef33523fbca2d48887380da96e0ca6f4ca4e8d6470f81649a8da2bb24a66 |
|
MD5 | a5aa3130b31a0319e0bc7805120298fb |
|
BLAKE2b-256 | d4e07b8ed96571b721e8d4ec657d2d5eb57b7f362c389b1ea3a31fabb50ea221 |
Provenance
File details
Details for the file sphinxcontrib.datatemplates-0.6.1-py2.py3-none-any.whl
.
File metadata
- Download URL: sphinxcontrib.datatemplates-0.6.1-py2.py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 880ae279e9b86076175e2cc0b2c2188184265542e96a76d25917706e7d838bab |
|
MD5 | 8084ecfd982e06cc5289dfd125e665fa |
|
BLAKE2b-256 | 7827bf3389568379f7d000c5cd0fdfc78b581e0cc6ec30f36a17fc8537bb13dd |