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.2.dev1.tar.gz (26.0 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.2.dev1-py2.py3-none-any.whl (13.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sphinxcontrib.datatemplates-0.7.2.dev1.tar.gz.

File metadata

  • Download URL: sphinxcontrib.datatemplates-0.7.2.dev1.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for sphinxcontrib.datatemplates-0.7.2.dev1.tar.gz
Algorithm Hash digest
SHA256 ca9b4a2909bac22b632742df8a804c23ab917513f27e2fbc250f9e7603921826
MD5 2f02045e2dd1b3199d1492ad0ac5b6c8
BLAKE2b-256 04409e7138ffc30f0c15457acf526051f6b6854d387dad51d3862666db36eab2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sphinxcontrib.datatemplates-0.7.2.dev1-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for sphinxcontrib.datatemplates-0.7.2.dev1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0d0c2469649d9fa387003afb3fc84096887cb66b22a249799dd430ab17e14ef3
MD5 5a33daccf16e05b4214e266c5ad469a3
BLAKE2b-256 68df7c1cbe0d0f7d7eca895d743337f234961490b94ae4e8446737f8131d4ae1

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