summaryrefslogtreecommitdiff
path: root/docutils/tools/html.py
blob: 66f029364151607b3bf1bcd9e3c38fa3ebb1e517 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python

"""
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Revision: $Revision$
:Date: $Date$
:Copyright: This module has been placed in the public domain.

A minimal front-end to the Docutils Publisher.

This module takes advantage of the default values defined in `publish()`.
"""

import sys
from docutils.core import publish
from docutils import utils

reporter = utils.Reporter(2, 4)
#reporter.setconditions('nodes.Node.walkabout', 2, 4, debug=1)

if len(sys.argv) == 2:
    publish(writername='html', source=sys.argv[1], reporter=reporter)
elif len(sys.argv) == 3:
    publish(writername='html', source=sys.argv[1], destination=sys.argv[2],
            reporter=reporter)
elif len(sys.argv) > 3:
    print >>sys.stderr, 'Maximum 2 arguments allowed.'
    sys.exit(1)
else:
    publish()