Construct RestructuredText markup and directives from Python Code.
Project description
Welcome to rstobj Documentation
rstobj is a library that construct Restructured Text markup or directives from Python Code. rstobj is based on jinja2.
Example:
import rstobj
ltable = rstobj.directives.ListTable(
data=[["id", "name"], [1, "Alice"], [2, "Bob"]],
title="Users",
header=True,
)
rst = ltable.render()
print(rst)
Output:
.. list-table:: Users :header-rows: 1 :stub-columns: 0 * - id - name * - 1 - Alice * - 2 - Bob
I recommend to use this in your jinja2 template, content of outut.rst:
{{ ltable.render() }}
And use rstobj with sphinx-jinja library https://pypi.org/project/sphinx-jinja/ in sphinx doc project.
Supported directives:
.. image::
.. list-table::
.. contents::
.. code-block::
.. include::
Supported markup:
Header:
.. _ref-label: Title =====
URL: `Text <Target>`_
Reference: :ref:`Text <Target>`
If you need more features, please submit an issue to https://github.com/MacHu-GWU/rstobj-project/issues
Install
rstobj is released on PyPI, so all you need is:
$ pip install rstobj
To upgrade to latest version:
$ pip install --upgrade rstobj
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for rstobj-0.0.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a077cbcad7c2df749b9cbd9e08d7734138b3c32c6b04b8273be37206824f113 |
|
MD5 | 23aff66fe8f5015390ccb380480674c1 |
|
BLAKE2b-256 | 6fb9fb7679ca6b36895e9de3a87873d75b32fddb926b0dff768f6d65c0544b40 |