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
Close
Hashes for sphinxcontrib.datatemplates-0.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac401de9550a6b1f42b80e596f631a88afe8f75bae7b8890539d2184a360bf10 |
|
MD5 | 7c54b44cf8dd766acc7912655fe83b18 |
|
BLAKE2b-256 | 5c47c42a169b4a32640cd54a78b1522473991793ed44509d89a674e4bf011f63 |
Close
Hashes for sphinxcontrib.datatemplates-0.5.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19eaa20a059f03a7d0f55b0efac823bd782102af9848616632524e5ac0230955 |
|
MD5 | 7b5b6d992e523664b93bf5470c551af9 |
|
BLAKE2b-256 | 774a214bcbe13e00bab467f92a111c0b460cb67e41e1c770072048148dc61c2d |