https://github.com/sphinx-contrib/datatemplates
Sphinx plugin for generating RST on the fly from data files and templates.
https://github.com/sphinx-contrib/datatemplates
python sphinx sphinx-doc sphinx-extension sphinxcontrib
Last synced: 3 days ago
JSON representation
Sphinx plugin for generating RST on the fly from data files and templates.
- Host: GitHub
- URL: https://github.com/sphinx-contrib/datatemplates
- Owner: sphinx-contrib
- License: other
- Created: 2015-09-13T18:45:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-21T14:58:11.000Z (over 1 year ago)
- Last Synced: 2025-04-16T22:05:14.080Z (24 days ago)
- Topics: python, sphinx, sphinx-doc, sphinx-extension, sphinxcontrib
- Language: Python
- Homepage: http://sphinxcontribdatatemplates.readthedocs.io/
- Size: 205 KB
- Stars: 45
- Watchers: 4
- Forks: 19
- Open Issues: 14
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
.. -*- mode: rst -*-
=============================
sphinxcontrib-datatemplates
=============================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.* Repo: https://github.com/sphinxcontrib/sphinxcontrib.datatemplates
* Docs: http://sphinxcontribdatatemplates.readthedocs.io/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: CSample 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.