Skip to main content

A reStructuredText to DocBook converter using Python's docutils.

Project description

A reStructuredText to DocBook command-line converter using Python’s docutils, with an included Sphinx builder.

Using the command-line utility

rst2db <filename> [-e root_element] [-o output_file] [-t template_file]

Only the filename to process is required. All other settings are optional.

Settings:

-e root_element

set the root element of the resulting docbook file. If this is not specified, then ‘section’ will be used.

-o output_file

set the output filename to write. If this is not specified, then output will be sent to stdout.

-t template_file

set a template file to use to dress the output. You must have Jinja2 installed to use this feature.

Use {{data.root_element}} and {{data.contents}} to represent the output of this script in your template.

Using the Sphinx builder

Configuration

To build docbook output with Sphinx, add abstrys.docbook.builder to the extensions list in conf.py:

extensions = [
   ... other extensions here ...
   abstrys.sphinx.docbook_builder
   ]

There are two configurable parameters for conf.py that correspond to rst2db.py parameters:

docbook_template_file:

template file that will be used to position the document parts. Requires Jinja2 to be installed if specified.

docbook_default_root_element:

default root element for a file-level document. Default is ‘section’.

Running a build

The builder is registered with the name ‘docbook’, so to run a build that uses the builder, run sphinx-build with -b docbook.

License

This software is provided under the BSD 3-Clause license. See the LICENSE file for more details.

For more information

Contact: Eron Hennessey <eron@abstrys.com>

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

rst2db-1.0.tar.gz (7.7 kB view details)

Uploaded Source

File details

Details for the file rst2db-1.0.tar.gz.

File metadata

  • Download URL: rst2db-1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rst2db-1.0.tar.gz
Algorithm Hash digest
SHA256 e70a3c40b84fd6a2e0e0590b9117d33692adf454015152fc5a11170d60aca168
MD5 4100b4860a8bfdb436a6fbf990bcc4a4
BLAKE2b-256 824c7d2fd9f49d966b74717309c5bd9da62a55a7fd6f8c7516e9156e25fdcda7

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