跳转到主要内容

Sphinx扩展,用于将数据文件渲染为漂亮的HTML

项目描述

此软件包包含 sphinxcontrib.datatemplates,这是一个Sphinx扩展,用于将reStructuredText页面的一部分从JSON、YAML和CSV等格式的数据文件中渲染出来。

样本YAML输入

---
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

样本模板

.. -*- 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',
    ) }}

渲染输出

在线查看 sphinx输出

项目详细信息


下载文件

下载适用于您平台的文件。如果您不确定该选择哪个,请了解更多关于安装包的信息。

源代码分发

sphinxcontrib.datatemplates-0.11.0.tar.gz (31.0 kB 查看哈希值)

上传时间 源代码

构建分发

sphinxcontrib.datatemplates-0.11.0-py3-none-any.whl (12.5 kB 查看哈希值)

上传时间 Python 3

由以下提供支持