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.11.0.tar.gz
.
File metadata
- Download URL: sphinxcontrib.datatemplates-0.11.0.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 793222e803430076341509cc167f8d715830b05e418c885313101d60fd442557 |
|
MD5 | f49f074581804e4cf33b74ab653e28e5 |
|
BLAKE2b-256 | b99e8ac54a6a3e7a00339f417568899b64a0c0d622429db73cc1a28c8122c8e2 |
File details
Details for the file sphinxcontrib.datatemplates-0.11.0-py3-none-any.whl
.
File metadata
- Download URL: sphinxcontrib.datatemplates-0.11.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88d02f5edab32b88211ebb72a90553e3676a5737877bad1de412f84058ac282e |
|
MD5 | 0719590012e62d6de023f6ff6faac36f |
|
BLAKE2b-256 | d48d7a7dd95ad1eedec8dc770570c8b1f3dc1d13357383635607b6629ccf329c |