summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/rst2html.py23
-rwxr-xr-xbin/rst2latex.py26
-rwxr-xr-xbin/rst2man.py26
-rwxr-xr-xbin/rst2newlatex.py25
-rwxr-xr-xbin/rst2odt.py30
-rwxr-xr-xbin/rst2odt_prepstyles.py67
-rwxr-xr-xbin/rst2pseudoxml.py23
-rwxr-xr-xbin/rst2s5.py24
-rwxr-xr-xbin/rst2xml.py23
9 files changed, 267 insertions, 0 deletions
diff --git a/bin/rst2html.py b/bin/rst2html.py
new file mode 100755
index 0000000..f187118
--- /dev/null
+++ b/bin/rst2html.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+# $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 minimal front end to the Docutils Publisher, producing HTML.
+"""
+
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline, default_description
+
+
+description = ('Generates (X)HTML documents from standalone reStructuredText '
+ 'sources. ' + default_description)
+
+publish_cmdline(writer_name='html', description=description)
diff --git a/bin/rst2latex.py b/bin/rst2latex.py
new file mode 100755
index 0000000..3fb71e0
--- /dev/null
+++ b/bin/rst2latex.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# $Id: rst2latex.py 5905 2009-04-16 12:04:49Z milde $
+# Author: David Goodger <goodger@python.org>
+# Copyright: This module has been placed in the public domain.
+
+"""
+A minimal front end to the Docutils Publisher, producing LaTeX.
+"""
+
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline
+
+description = ('Generates LaTeX documents from standalone reStructuredText '
+ 'sources. '
+ 'Reads from <source> (default is stdin) and writes to '
+ '<destination> (default is stdout). See '
+ '<http://docutils.sourceforge.net/docs/user/latex.html> for '
+ 'the full reference.')
+
+publish_cmdline(writer_name='latex', description=description)
diff --git a/bin/rst2man.py b/bin/rst2man.py
new file mode 100755
index 0000000..230d39b
--- /dev/null
+++ b/bin/rst2man.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Author:
+# Contact: grubert@users.sf.net
+# Copyright: This module has been placed in the public domain.
+
+"""
+man.py
+======
+
+This module provides a simple command line interface that uses the
+man page writer to output from ReStructuredText source.
+"""
+
+import locale
+try:
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline, default_description
+from docutils.writers import manpage
+
+description = ("Generates plain unix manual documents. " + default_description)
+
+publish_cmdline(writer=manpage.Writer(), description=description)
diff --git a/bin/rst2newlatex.py b/bin/rst2newlatex.py
new file mode 100755
index 0000000..031ca45
--- /dev/null
+++ b/bin/rst2newlatex.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+# $Id: rst2newlatex.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 minimal front end to the Docutils Publisher, producing LaTeX using
+the new LaTeX writer.
+"""
+
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline, default_description
+
+
+description = ('Generates LaTeX documents from standalone reStructuredText '
+ 'sources. This writer is EXPERIMENTAL and should not be used '
+ 'in a production environment. ' + default_description)
+
+publish_cmdline(writer_name='newlatex2e', description=description)
diff --git a/bin/rst2odt.py b/bin/rst2odt.py
new file mode 100755
index 0000000..5d8971f
--- /dev/null
+++ b/bin/rst2odt.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+# $Id: rst2odt.py 5839 2009-01-07 19:09:28Z dkuhlman $
+# Author: Dave Kuhlman <dkuhlman@rexx.com>
+# Copyright: This module has been placed in the public domain.
+
+"""
+A front end to the Docutils Publisher, producing OpenOffice documents.
+"""
+
+import sys
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline_to_binary, default_description
+from docutils.writers.odf_odt import Writer, Reader
+
+
+description = ('Generates OpenDocument/OpenOffice/ODF documents from '
+ 'standalone reStructuredText sources. ' + default_description)
+
+
+writer = Writer()
+reader = Reader()
+output = publish_cmdline_to_binary(reader=reader, writer=writer,
+ description=description)
+
diff --git a/bin/rst2odt_prepstyles.py b/bin/rst2odt_prepstyles.py
new file mode 100755
index 0000000..b0b7dcc
--- /dev/null
+++ b/bin/rst2odt_prepstyles.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+
+# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
+# Author: Dave Kuhlman <dkuhlman@rexx.com>
+# Copyright: This module has been placed in the public domain.
+
+"""
+Fix a word-processor-generated styles.odt for odtwriter use: Drop page size
+specifications from styles.xml in STYLE_FILE.odt.
+"""
+
+#
+# Author: Michael Schutte <michi@uiae.at>
+
+from lxml import etree
+import sys
+import zipfile
+from tempfile import mkstemp
+import shutil
+import os
+
+NAMESPACES = {
+ "style": "urn:oasis:names:tc:opendocument:xmlns:style:1.0",
+ "fo": "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+}
+
+def prepstyle(filename):
+
+ zin = zipfile.ZipFile(filename)
+ styles = zin.read("styles.xml")
+
+ root = etree.fromstring(styles)
+ for el in root.xpath("//style:page-layout-properties",
+ namespaces=NAMESPACES):
+ for attr in el.attrib:
+ if attr.startswith("{%s}" % NAMESPACES["fo"]):
+ del el.attrib[attr]
+
+ tempname = mkstemp()
+ zout = zipfile.ZipFile(os.fdopen(tempname[0], "w"), "w",
+ zipfile.ZIP_DEFLATED)
+
+ for item in zin.infolist():
+ if item.filename == "styles.xml":
+ zout.writestr(item, etree.tostring(root))
+ else:
+ zout.writestr(item, zin.read(item.filename))
+
+ zout.close()
+ zin.close()
+ shutil.move(tempname[1], filename)
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) != 1:
+ print >> sys.stderr, __doc__
+ print >> sys.stderr, "Usage: %s STYLE_FILE.odt\n" % sys.argv[0]
+ sys.exit(1)
+ filename = args[0]
+ prepstyle(filename)
+
+if __name__ == '__main__':
+ main()
+
+
+# vim:tw=78:sw=4:sts=4:et:
diff --git a/bin/rst2pseudoxml.py b/bin/rst2pseudoxml.py
new file mode 100755
index 0000000..980ff22
--- /dev/null
+++ b/bin/rst2pseudoxml.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+# $Id: rst2pseudoxml.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 minimal front end to the Docutils Publisher, producing pseudo-XML.
+"""
+
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline, default_description
+
+
+description = ('Generates pseudo-XML from standalone reStructuredText '
+ 'sources (for testing purposes). ' + default_description)
+
+publish_cmdline(description=description)
diff --git a/bin/rst2s5.py b/bin/rst2s5.py
new file mode 100755
index 0000000..17157a8
--- /dev/null
+++ b/bin/rst2s5.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+# $Id: rst2s5.py 4564 2006-05-21 20:44:42Z wiemann $
+# Author: Chris Liechti <cliechti@gmx.net>
+# Copyright: This module has been placed in the public domain.
+
+"""
+A minimal front end to the Docutils Publisher, producing HTML slides using
+the S5 template system.
+"""
+
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline, default_description
+
+
+description = ('Generates S5 (X)HTML slideshow documents from standalone '
+ 'reStructuredText sources. ' + default_description)
+
+publish_cmdline(writer_name='s5', description=description)
diff --git a/bin/rst2xml.py b/bin/rst2xml.py
new file mode 100755
index 0000000..b8f0379
--- /dev/null
+++ b/bin/rst2xml.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+# $Id: rst2xml.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 minimal front end to the Docutils Publisher, producing Docutils XML.
+"""
+
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline, default_description
+
+
+description = ('Generates Docutils-native XML from standalone '
+ 'reStructuredText sources. ' + default_description)
+
+publish_cmdline(writer_name='xml', description=description)