Skip to main content

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


Download files

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

Source Distribution

sphinxcontrib.datatemplates-0.8.1.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

sphinxcontrib.datatemplates-0.8.1-py2.py3-none-any.whl (13.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sphinxcontrib.datatemplates-0.8.1.tar.gz.

File metadata

  • Download URL: sphinxcontrib.datatemplates-0.8.1.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for sphinxcontrib.datatemplates-0.8.1.tar.gz
Algorithm Hash digest
SHA256 3035e2f9ed20ef013556da3a9f166f89c1f433ff9839cba798f96b41461ce5be
MD5 bca6fa439b19dc3dd025fac264d6a48d
BLAKE2b-256 c6c64aad59f960eadac920a21b6742251a922a8b4f33ad1bf7bb1d8030448f7c

See more details on using hashes here.

File details

Details for the file sphinxcontrib.datatemplates-0.8.1-py2.py3-none-any.whl.

File metadata

  • Download URL: sphinxcontrib.datatemplates-0.8.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for sphinxcontrib.datatemplates-0.8.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0e20398784509a19815e7a9254f515839c8e312aba5602b3b94f419856791822
MD5 547b56b9c4d2020063c5fc0073ed2bbc
BLAKE2b-256 0af776c1ea29425485c950d6d6d7a35c4098389103cf66965f28a6d535c0d245

See more details on using hashes here.

Supported by

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