diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/python/lib/2.5/docutils-0.5-py2.5.egg/docutils/writers/docutils_xml.py --- a/buildframework/helium/external/python/lib/2.5/docutils-0.5-py2.5.egg/docutils/writers/docutils_xml.py Wed Oct 28 14:39:48 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -# $Id: docutils_xml.py 4564 2006-05-21 20:44:42Z wiemann $ -# Author: David Goodger -# Copyright: This module has been placed in the public domain. - -""" -Simple internal document tree Writer, writes Docutils XML. -""" - -__docformat__ = 'reStructuredText' - - -import docutils -from docutils import frontend, writers - - -class Writer(writers.Writer): - - supported = ('xml',) - """Formats this writer supports.""" - - settings_spec = ( - '"Docutils XML" Writer Options', - 'Warning: the --newlines and --indents options may adversely affect ' - 'whitespace; use them only for reading convenience.', - (('Generate XML with newlines before and after tags.', - ['--newlines'], - {'action': 'store_true', 'validator': frontend.validate_boolean}), - ('Generate XML with indents and newlines.', - ['--indents'], - {'action': 'store_true', 'validator': frontend.validate_boolean}), - ('Omit the XML declaration. Use with caution.', - ['--no-xml-declaration'], - {'dest': 'xml_declaration', 'default': 1, 'action': 'store_false', - 'validator': frontend.validate_boolean}), - ('Omit the DOCTYPE declaration.', - ['--no-doctype'], - {'dest': 'doctype_declaration', 'default': 1, - 'action': 'store_false', 'validator': frontend.validate_boolean}),)) - - settings_defaults = {'output_encoding_error_handler': 'xmlcharrefreplace'} - - config_section = 'docutils_xml writer' - config_section_dependencies = ('writers',) - - output = None - """Final translated form of `document`.""" - - xml_declaration = '\n' - #xml_stylesheet = '\n' - doctype = ( - '\n') - generator = '\n' - - def translate(self): - settings = self.document.settings - indent = newline = '' - if settings.newlines: - newline = '\n' - if settings.indents: - newline = '\n' - indent = ' ' - output_prefix = [] - if settings.xml_declaration: - output_prefix.append( - self.xml_declaration % settings.output_encoding) - if settings.doctype_declaration: - output_prefix.append(self.doctype) - output_prefix.append(self.generator % docutils.__version__) - docnode = self.document.asdom().childNodes[0] - self.output = (''.join(output_prefix) - + docnode.toprettyxml(indent, newline))