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.3.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

sphinxcontrib.datatemplates-0.3.0-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: sphinxcontrib.datatemplates-0.3.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.4

File hashes

Hashes for sphinxcontrib.datatemplates-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c7247c7c83112fa6a8725f948730afb59d64deddcbebc345613b8ae3176b2039
MD5 78b52c48ac1b6ddd0ec769dd35fef343
BLAKE2b-256 c3b2aacd747a9501e75f6e745e707ca31c5a730e2492d7e6435a1c266dd5e322

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sphinxcontrib.datatemplates-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.4

File hashes

Hashes for sphinxcontrib.datatemplates-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 25cbc95ea59a9c30e9d40b03a013b0c3baede9fdb2f519b4fb6db23cd6108da0
MD5 b94632b98064b7be2edb189808a9f5cc
BLAKE2b-256 09ca4084afc695c1809c9fdacd99e3a6980cce47b040aa0641bc813962d45948

See more details on using hashes here.

Supported by

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