updated for Docutils API changes

This commit is contained in:
David Goodger 2002-10-18 05:19:08 +00:00
parent 8e4c8019b1
commit 623c977f6e
1 changed files with 12 additions and 12 deletions

View File

@ -41,7 +41,7 @@ import random
import time import time
REQUIRES = {'python': '2.2', REQUIRES = {'python': '2.2',
'docutils': '0.2.3'} 'docutils': '0.2.6'}
PROGRAM = sys.argv[0] PROGRAM = sys.argv[0]
RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html' RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html'
PEPURL = 'pep-%04d.html' PEPURL = 'pep-%04d.html'
@ -280,9 +280,9 @@ def fixfile(inpath, input_lines, outfile):
print >> outfile, '</html>' print >> outfile, '</html>'
docutils_options = None docutils_settings = None
"""Option value object used by Docutils. Can be set by the client application """Runtime settings object used by Docutils. Can be set by the client
when this module is imported.""" application when this module is imported."""
def fix_rst_pep(inpath, input_lines, outfile): def fix_rst_pep(inpath, input_lines, outfile):
from docutils import core, io from docutils import core, io
@ -290,17 +290,17 @@ def fix_rst_pep(inpath, input_lines, outfile):
pub.set_reader(reader_name='pep', parser_name='restructuredtext', pub.set_reader(reader_name='pep', parser_name='restructuredtext',
parser=None) parser=None)
pub.set_writer(writer_name='pep_html') pub.set_writer(writer_name='pep_html')
if docutils_options: if docutils_settings:
options = docutils_options settings = docutils_settings
pub.options = options pub.settings = settings
else: else:
options = pub.set_options() settings = pub.get_settings()
options._source = inpath settings._source = inpath
options._destination = outfile.name settings._destination = outfile.name
pub.source = io.StringInput( pub.source = io.StringInput(
options, source=''.join(input_lines), source_path=inpath) settings, source=''.join(input_lines), source_path=inpath)
pub.destination = io.FileOutput( pub.destination = io.FileOutput(
options, destination=outfile, destination_path=outfile.name, settings, destination=outfile, destination_path=outfile.name,
autoclose=0) autoclose=0)
pub.publish() pub.publish()