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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinxcontrib.datatemplates-0.10.2-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for sphinxcontrib.datatemplates-0.10.2.tar.gz
Algorithm Hash digest
SHA256 d1a35d79922db7698fbc75e7e5784e6859222fd99a3cc6c0611dd6132fd3a136
MD5 49378e61c4e3983834ed9355e24beaf2
BLAKE2b-256 65dc83f5f1dc000d409efa9244da90f724e3f4a10013c50c70ea06190a1de200

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sphinxcontrib.datatemplates-0.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 442580888f3dc37eb334486b4268d35dd745b78baa4f11ac1f04141de56fadfe
MD5 3318ffee62a1c21faef8653b8eb23ebd
BLAKE2b-256 7d8104d7a7186541a126b83e052702dc2f052ca168d5b335914804d8e2509cbd

See more details on using hashes here.

Supported by

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