Skip to main content

An OpenDocument to Sphinx converter.

Project description

What is it ?

Odt2sphinx converts OpenDocument Text file(s) to one or several .rst files.

This is a fork of Christophe de Vienne odt2sphinx.

Install

pip install metapensiero.odt2sphinx

Usage

usage: odt2sphinx [-h] [--debug] [--download-source-link]
                  [--encoding ENCODING]
                  source [target]

ODT to RST

positional arguments:
  source                Source ODT file to be converted
  target                Either destination directory or single .rst target
                        filename

optional arguments:
  -h, --help            show this help message and exit
  --debug               Emit debug noise
  --download-source-link
                        Add a link to the ODT source file
  --encoding ENCODING   Output encoding, by default UTF-8

Output files

There are two modes of operation:

  1. Sphinx, splitting the source in multiple files, one per chapter

  2. Monolithic single plain reST output

The first mode is selected by omitting the second positional argument, or giving it the name of a directory. The latter is selected by specifing a file name with a .rst extension as the second positional argument.

Multiple files mode

The files are generated in the target dir, which by default has the same name as the .odt file minus the extension.

At least one file, “index.rst”, will be written. Depending on the document content, additional rst files may be generated.

Images are extracted and put together in an “images” directory inside the targetdir.

Monolithic output mode

All the output goes into the single rst file specified as the second positional argument.

Images are extracted and put together in an “images” directory inside the directory containing the output file.

Styles mapping

The following rules will be applied to particulary styles when converting an .odt file. The style names are case-insensitive.

“Title” (in any language)

Becomes the main document title (underlined with ‘=’)

“Title 1”

Creates a new page named after the title, and becomes this page main title (underlined with ‘=’); a reference to this file is inserted in a .. toctree directive of the index.rst file

“Title 2” to “Title 6”

Becomes sub-chapter titles, underlined respectively ‘-’, ‘~’, ‘^’, ‘”’, “’”

“Warning” (or “Avertissement”)

The chapter becomes the content of a .. warning directive

“Tip” (or “Trucs & Astuces”)

The chapter becomes the content of a .. tip directive

“Note” or “Information”

The chapter becomes the content of a .. note directive

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

File details

Details for the file metapensiero.odt2sphinx-1.0.dev20151105.tar.gz.

File metadata

File hashes

Hashes for metapensiero.odt2sphinx-1.0.dev20151105.tar.gz
Algorithm Hash digest
SHA256 c0ffe21baa00cb6ac9aa851a1218e0781aba9b821731a1b95516f037d320a800
MD5 986c8f0ef6a1085c4acec59ecff54f93
BLAKE2b-256 0bb1821a24e6c875b2fa381a363b49858ab8fc593d16893fdb98d6ab07d52e18

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