|
From: <mi...@us...> - 2018-11-21 13:58:59
|
Revision: 8236
http://sourceforge.net/p/docutils/code/8236
Author: milde
Date: 2018-11-21 13:58:57 +0000 (Wed, 21 Nov 2018)
Log Message:
-----------
Definition list terms must not use "rawsource" attribute for escaping.
Remove implementation of escaping the classifier delimiter in
definition list terms that relies on the "rawsource" attribute.
This is not safe (rawsource is only for information and debugging purposes).
A proper fix can be done with null-escaped text in Text nodes.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/parsers/rst/states.py
trunk/docutils/test/test_parsers/test_rst/test_definition_lists.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2018-11-21 13:58:51 UTC (rev 8235)
+++ trunk/docutils/HISTORY.txt 2018-11-21 13:58:57 UTC (rev 8236)
@@ -28,7 +28,7 @@
* docutils/io.py
- - Fix [ 348 ] Since Python 3.4, the 'U' universal newlines mode has been
+ - Fix [ 348 ] Since Python 3.4, the 'U' universal newlines mode has been
deprecated (thanks to hugovk).
* docutils/nodes.py
@@ -39,9 +39,7 @@
* docutils/parsers/rst/states.py:
- Allow embedded colons in field list field names.
- - Add `rawsource` attribute for text of inline elements and definition
- list terms.
- - Fix: definition list term classifier starting with a reference crash.
+ - Add `rawsource` attribute for text of inline elements.
* docutils/parsers/rst/directives/html.py:
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2018-11-21 13:58:51 UTC (rev 8235)
+++ trunk/docutils/docutils/parsers/rst/states.py 2018-11-21 13:58:57 UTC (rev 8236)
@@ -2855,7 +2855,7 @@
for i in range(len(text_nodes)):
node = text_nodes[i]
if isinstance(node, nodes.Text):
- parts = self.classifier_delimiter.split(node.rawsource)
+ parts = self.classifier_delimiter.split(node)
if len(parts) == 1:
node_list[-1] += node
else:
@@ -2863,9 +2863,8 @@
textnode = nodes.Text(utils.unescape(text, True))
node_list[-1] += textnode
for part in parts[1:]:
- classifier_node = nodes.classifier(
- unescape(part, True), part)
- node_list.append(classifier_node)
+ node_list.append(
+ nodes.classifier(unescape(part, True), part))
else:
node_list[-1] += node
return node_list, messages
Modified: trunk/docutils/test/test_parsers/test_rst/test_definition_lists.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_definition_lists.py 2018-11-21 13:58:51 UTC (rev 8235)
+++ trunk/docutils/test/test_parsers/test_rst/test_definition_lists.py 2018-11-21 13:58:57 UTC (rev 8236)
@@ -246,8 +246,6 @@
Because there's no space before the colon.
Term :not a classifier
Because there's no space after the colon.
-Term \: not a classifier
- Because the colon is escaped.
""",
"""\
<document source="test data">
@@ -264,12 +262,6 @@
<definition>
<paragraph>
Because there's no space after the colon.
- <definition_list_item>
- <term>
- Term : not a classifier
- <definition>
- <paragraph>
- Because the colon is escaped.
"""],
["""\
``Term : not a classifier``
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|