Skip to main content

Construct RestructuredText markup and directives from Python Code.

Project description

Documentation Status https://travis-ci.org/MacHu-GWU/rstobj-project.svg?branch=master https://codecov.io/gh/MacHu-GWU/rstobj-project/branch/master/graph/badge.svg https://img.shields.io/pypi/v/rstobj.svg https://img.shields.io/pypi/l/rstobj.svg https://img.shields.io/pypi/pyversions/rstobj.svg https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social
https://img.shields.io/badge/Link-Document-blue.svg https://img.shields.io/badge/Link-API-blue.svg https://img.shields.io/badge/Link-Source_Code-blue.svg https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rstobj-0.0.5.tar.gz (31.5 kB view hashes)

Uploaded source

Built Distribution

rstobj-0.0.5-py2.py3-none-any.whl (75.2 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page