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.
- Repo: https://github.com/sphinxcontrib/sphinxcontrib.datatemplates
- Docs: http://sphinxcontribdatatemplates.readthedocs.io/
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size sphinxcontrib.datatemplates-0.4.0-py2.py3-none-any.whl (9.5 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes View |
Filename, size sphinxcontrib.datatemplates-0.4.0.tar.gz (16.5 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for sphinxcontrib.datatemplates-0.4.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c6c5ca124499d85b174e239bc1506d643425eaac325ad62f39a89fd982d071 |
|
MD5 | 29013758e6a1a17bf11fcd1612c202c8 |
|
BLAKE2-256 | b18e935598d6c8487daf63131f5d2db0a8ae7ac170c6d31bda627db38bac0a51 |
Close
Hashes for sphinxcontrib.datatemplates-0.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed8abf973bd4fc5e779fc21aa4ac02d0bfbaf869bce3a9b0345ff360c9a23b14 |
|
MD5 | 2876d865bafc31f4a71070a9e956919d |
|
BLAKE2-256 | 1b5f87437d6b055b27f0ac029f21b30f9e7a74639e198725067790dcab1e9d88 |