Skip to main content

A simple Python API for generating RestructuredText.

Project description

Background and Goals

reStructuredText is a powerful human-centric markup language that is well defined, flexible, with powerful tools that make writing and maintaining text easy and pleasurable. Humans can edit reStructuredText without the aide of complex editing tools, and the resulting source is easy to manipulate and process.

One of the key features of reSturcturedText is it’s relatively complete extension API, which makes it possible to minimize fragile repetitive structures in source files and increase the ease of production. While you can use these extensions to build custom content types with ease, extensions make reStructuredText source less portable and less intuitive to edit for casual contributors.

As an alternative and a supplement, RstCloth is a Python API for writing well formed reStructuredText programatically. RstCloth facilitates :

  • generating data-driven content views into existing reStructuredText environments and tools.

  • automating content generation and modification without creating unportable-restructured text.

  • ensuring that the tool chain is easily debugable by using transparent intermediate formats.

Example Use

The following RstCloth code:

from rstcloth import RstCloth

d = RstCloth()


d.title('Example Use')
d.newline()
d.h2('Contents')
d.directive(name="contents", fields=[('local', ''), ('backlinks', 'None')])
d.newline()
d.h2('Code -- shebang')
d.codeblock('#!/usr/bin/env')

d.print_content()

Would result in the following reStructuredText:

===========
Example Use
===========

Contents
--------

.. contents::
   :local:
   :backlinks: None

Code -- shebang
---------------

::

   #!/usr/bin/env

Status

RstCloth is undergoing ongoing development and expansion is not stable at this point. Current features and projects include:

  • improve documentation.

  • develop unit testing framework to ensure consistent API behavior.

  • build/extend a table generation API.

  • improve paragraph level content generation API.

See the issue tracker for a more complete list of current and future projects.

Project

Source repository: the canonical git.cyborginstitute.net repository has a github mirror.

Issue tracker: cyborg institute bugzilla.

Listserv: cyborg institute listserv.

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

rstcloth-0.2.1.tar.gz (9.9 kB view details)

Uploaded Source

File details

Details for the file rstcloth-0.2.1.tar.gz.

File metadata

  • Download URL: rstcloth-0.2.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rstcloth-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a566dc7e6402f7c974e88c6a3f2a90a834d1aa713a72d78054de279dde81f6c4
MD5 205ac6262f89d6e70424dcb8ce33e61a
BLAKE2b-256 2f9cb7f92decf571f8e629b430cf889b7c8d599011fd6802953ea0ec1b08fa50

See more details on using hashes here.

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