19 |
# Creating the pegboard |
# Creating the pegboard |
20 |
# Must be run in the main directory (the one Makefile is in). |
# Must be run in the main directory (the one Makefile is in). |
21 |
|
|
22 |
|
import docutils |
23 |
import docutils.core |
import docutils.core |
24 |
import sys, os, os.path |
import sys, os, os.path |
25 |
|
|
45 |
print "Process PEG %s" % (peg,) |
print "Process PEG %s" % (peg,) |
46 |
|
|
47 |
args = '-stg --stylesheet doc/gzz.css %s.rst %s.html' % (f,f) |
args = '-stg --stylesheet doc/gzz.css %s.rst %s.html' % (f,f) |
48 |
|
|
49 |
|
# Generate the HTML |
50 |
docutils.core.publish(writer_name='html', argv=args.split()) |
docutils.core.publish(writer_name='html', argv=args.split()) |
51 |
|
|
52 |
|
if 0: |
53 |
|
#config = docutils.frontend.ConfigParser() |
54 |
|
#defaults = config.get_section('options') |
55 |
|
opts = docutils.frontend.OptionParser() |
56 |
|
#opts.set_defaults(**defaults) |
57 |
|
opts.input_encoding = "utf-8" |
58 |
|
opts.report_level = "0" |
59 |
|
opts.halt_level = "3" |
60 |
|
opts.warning_stream = sys.stdout |
61 |
|
opts.debug = "0" |
62 |
|
opts.language_code = "en" |
63 |
|
|
64 |
|
ioobj = docutils.io.FileIO(opts, source_path="%s.rst" % (f,)) |
65 |
|
reader = docutils.readers.get_reader_class("rst")(None, None) |
66 |
|
# doc = reader.read(ioobj, "restructuredtext", opts) |
67 |
|
reader.set_parser("restructuredtext") |
68 |
|
doc = reader.read(ioobj, None, opts) |
69 |
|
print doc |