rst2html_extended.py 1.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

# $Id: rst2html.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.

"""
A customized front end to the Docutils Publisher, producing HTML with support for embedded images and Tikz figures.
"""

try:
    import locale

    locale.setlocale(locale.LC_ALL, "")
except:
    pass

from docutils.core import publish_cmdline, default_description
from docutils.parsers.rst import directives
21
from docutils.parsers.rst.directives.body import ParsedLiteral
22 23 24 25 26 27 28 29 30
from ..directives import EmbeddedImage, Tikz, TikzFigure, set_output_mode


description = "Generates (X)HTML documents from standalone reStructuredText " "sources.  " + default_description


def main():
    set_output_mode("html")
    directives.register_directive("embedded-image", EmbeddedImage)
31
    directives.register_directive("jupyter-outbox", ParsedLiteral)
32 33 34 35 36 37 38
    directives.register_directive("tikz", Tikz)
    directives.register_directive("tikz-figure", TikzFigure)
    publish_cmdline(writer_name="html", description=description)


if __name__ == '__main__':
    main()