[Python-checkins] r62539 - in doctools/trunk: CHANGES sphinx/htmlwriter.py

georg.brandl python-checkins at python.org
Sun Apr 27 21:53:27 CEST 2008


Author: georg.brandl
Date: Sun Apr 27 21:53:27 2008
New Revision: 62539

Log:
Fix a bug where smartypants was used for attribute values.


Modified:
   doctools/trunk/CHANGES
   doctools/trunk/sphinx/htmlwriter.py

Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Sun Apr 27 21:53:27 2008
@@ -91,6 +91,8 @@
 
 * sphinx.htmlwriter: Don't use os.path for joining image HREFs.
 
+* sphinx.htmlwriter: Don't use SmartyPants for HTML attribute values.
+
 * sphinx.latexwriter: Implement option lists.  Also, some other changes
   were made to ``sphinx.sty`` in order to enhance compatibility and
   remove old unused stuff.  Thanks to Gael Varoquaux for that!

Modified: doctools/trunk/sphinx/htmlwriter.py
==============================================================================
--- doctools/trunk/sphinx/htmlwriter.py	(original)
+++ doctools/trunk/sphinx/htmlwriter.py	Sun Apr 27 21:53:27 2008
@@ -351,8 +351,11 @@
         finally:
             self.no_smarty -= 1
 
-    def encode(self, text):
-        text = HTMLTranslator.encode(self, text)
-        if self.no_smarty <= 0:
-            text = sphinx_smarty_pants(text)
-        return text
+    def visit_Text(self, node):
+        text = node.astext()
+        encoded = self.encode(text)
+        if self.in_mailto and self.settings.cloak_email_addresses:
+            encoded = self.cloak_email(encoded)
+        elif self.no_smarty <= 0:
+            encoded = sphinx_smarty_pants(encoded)
+        self.body.append(encoded)


More information about the Python-checkins mailing list