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
  - list item 1
  - list item 2
  - list item 3
  - ['a', 'b', 'c']
  - ['A', 'B', 'C']
  - 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

{{ make_list_table(
    ['One', 'Two', 'Three'],
    title='Table from nested lists',
    ) }}

Mapping Series Table

Rendering a table from a list of nested dictionaries using dynamic

{{ make_list_table_from_mappings(
    [('One', 'cola'), ('Two', 'colb'), ('Three', 'colc')],
    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.7.2.tar.gz (26.1 kB view hashes)

Uploaded Source

Built Distribution

sphinxcontrib.datatemplates-0.7.2-py2.py3-none-any.whl (13.4 kB view hashes)

Uploaded Python 2 Python 3

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