Author: milde
Date: 2011-11-24 09:59:47 +0100 (Thu, 24 Nov 2011)
New Revision: 7226
Modified:
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/writers/docutils_xml.py
trunk/docutils/test/test_writers/test_docutils_xml.py
Log:
Fix 3423983 DocutilsXMLTestCase with indent and newlines options
Add sample strings with the new XML formatting introduced in versions 2.7.3
and 3.2.3 on 2011-11-18 to fix http://bugs.python.org/issue4147
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2011-11-23 22:01:02 UTC (rev 7225)
+++ trunk/docutils/docs/user/config.txt 2011-11-24 08:59:47 UTC (rev 7226)
@@ -459,7 +459,7 @@
``--leave-comments``.
_`strip_elements_with_classes`
- Comma-separated list of "classes" attribute values;
+ Comma-separated list of "classes" attribute values;
matching elements are removed from the document tree.
The command line option may be used more than once.
@@ -647,6 +647,15 @@
[docutils_xml writer]
`````````````````````
+.. Caution::
+
+ * In versions older than 2.7.3 and 3.2.3, the newlines_ and indents_
+ options may adversely affect whitespace; use them only for reading
+ convenience (see http://bugs.python.org/issue4147).
+
+ * The XML declaration carries text encoding information, without which
+ standard tools may be unable to read the generated XML.
+
_`doctype_declaration`
Generate XML with a DOCTYPE declaration.
@@ -668,10 +677,6 @@
Generate XML with an XML declaration. Also defined for the
`HTML Writer`__.
- .. Caution:: The XML declaration carries text encoding
- information, without which standard tools may be unable to read
- the generated XML.
-
Default: do (1). Options: ``--no-xml-declaration``.
__ `xml_declaration [html4css1 writer]`_
Modified: trunk/docutils/docutils/writers/docutils_xml.py
===================================================================
--- trunk/docutils/docutils/writers/docutils_xml.py 2011-11-23 22:01:02 UTC (rev 7225)
+++ trunk/docutils/docutils/writers/docutils_xml.py 2011-11-24 08:59:47 UTC (rev 7226)
@@ -20,8 +20,9 @@
settings_spec = (
'"Docutils XML" Writer Options',
- 'Warning: the --newlines and --indents options may adversely affect '
- 'whitespace; use them only for reading convenience.',
+ 'Warning: In versions older than 2.7.3 and 3.2.3, the --newlines and '
+ '--indents options may adversely affect whitespace; use them only '
+ 'for reading convenience (see http://bugs.python.org/issue4147).',
(('Generate XML with newlines before and after tags.',
['--newlines'],
{'action': 'store_true', 'validator': frontend.validate_boolean}),
Modified: trunk/docutils/test/test_writers/test_docutils_xml.py
===================================================================
--- trunk/docutils/test/test_writers/test_docutils_xml.py 2011-11-23 22:01:02 UTC (rev 7225)
+++ trunk/docutils/test/test_writers/test_docutils_xml.py 2011-11-24 08:59:47 UTC (rev 7226)
@@ -10,6 +10,7 @@
from __init__ import DocutilsTestSupport
+import sys
import docutils
import docutils.core
@@ -40,6 +41,14 @@
bodynewlines = u"""\
<document source="<string>">
+<paragraph>Test</paragraph>
+<transition/>
+<paragraph>Test. \xe4\xf6\xfc€</paragraph>
+</document>
+"""
+
+bodynewlines_old = u"""\
+<document source="<string>">
<paragraph>
Test
</paragraph>
@@ -52,6 +61,14 @@
bodyindents = u"""\
<document source="<string>">
+ <paragraph>Test</paragraph>
+ <transition/>
+ <paragraph>Test. \xe4\xf6\xfc€</paragraph>
+</document>
+"""
+
+bodyindents_old = u"""\
+<document source="<string>">
<paragraph>
Test
</paragraph>
@@ -62,7 +79,14 @@
</document>
"""
+# New formatting introduced in versions 2.7.3 and 3.2.3 on 2011-11-18
+# to fix http://bugs.python.org/issue4147
+if (sys.version_info < (2, 7, 3) or
+ sys.version_info[0] == 3 and sys.version_info < (3, 2, 3)):
+ bodynewlines = bodynewlines_old
+ bodyindents = bodyindents_old
+
class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase):
def test_publish(self):
|