|
From: <mi...@us...> - 2017-07-26 21:25:10
|
Revision: 8144
http://sourceforge.net/p/docutils/code/8144
Author: milde
Date: 2017-07-26 21:25:08 +0000 (Wed, 26 Jul 2017)
Log Message:
-----------
smartquotes transform: Keep "rawsource" when "educating" quotes.
Thanks to Matthew Brett for report and patch.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/transforms/universal.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2017-07-17 10:43:39 UTC (rev 8143)
+++ trunk/docutils/HISTORY.txt 2017-07-26 21:25:08 UTC (rev 8144)
@@ -59,7 +59,8 @@
* docutils/transforms/universal.py
- Fix SmartQuotes: warn only once if language is unsupported
+ Fix SmartQuotes: warn only once if language is unsupported,
+ keep "rawsource" when "educating" quotes.
* docutils/utils/__init__.py:
Modified: trunk/docutils/docutils/transforms/universal.py
===================================================================
--- trunk/docutils/docutils/transforms/universal.py 2017-07-17 10:43:39 UTC (rev 8143)
+++ trunk/docutils/docutils/transforms/universal.py 2017-07-26 21:25:08 UTC (rev 8144)
@@ -208,6 +208,7 @@
if class_value in self.strip_elements:
return 1
+
class SmartQuotes(Transform):
"""
@@ -304,6 +305,7 @@
attr=self.smartquotes_action, language=lang)
for txtnode, newtext in zip(txtnodes, teacher):
- txtnode.parent.replace(txtnode, nodes.Text(newtext))
+ txtnode.parent.replace(txtnode, nodes.Text(newtext,
+ rawsource=txtnode.rawsource))
self.unsupported_languages = set() # reset
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|