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.7.1.tar.gz (24.7 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.7.1-py2.py3-none-any.whl (13.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: sphinxcontrib.datatemplates-0.7.1.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for sphinxcontrib.datatemplates-0.7.1.tar.gz
Algorithm Hash digest
SHA256 f0143d891353b8159264b263d1e90e8d87c6de482e36f507ad4e96f9e4e1473f
MD5 16b4c6cec06aa205a3bf08cb13e13e9c
BLAKE2b-256 b0bc1f508384cd7f793ba0f2d046da6c50713ab070bd284a232441fc7aaed20d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sphinxcontrib.datatemplates-0.7.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for sphinxcontrib.datatemplates-0.7.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3dac36b42996f69e0e58306525bca2a0bc03fa203e67fcc80460bbb19e152625
MD5 f9c3917338b4262ac549573590d8c54e
BLAKE2b-256 128d15e2782cf4882ae300384725b910135fba992658616c31ffda53494b87e2

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