summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeorg.brandl <devnull@localhost>2008-04-27 19:53:27 +0000
committergeorg.brandl <devnull@localhost>2008-04-27 19:53:27 +0000
commitd77854a2345f168fa8f9e998e82f8995b14ce982 (patch)
tree7c6133203f91ad2c539b1f99718081f9a39bc803
parent2261b8cdb910257261b5a13da3b1b7bb4bee87ab (diff)
downloadsphinx-d77854a2345f168fa8f9e998e82f8995b14ce982.tar.gz
Fix a bug where smartypants was used for attribute values.
-rw-r--r--CHANGES2
-rw-r--r--sphinx/htmlwriter.py13
2 files changed, 10 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index 05c4de60..a3270571 100644
--- a/CHANGES
+++ b/CHANGES
@@ -91,6 +91,8 @@ Bugs fixed
* 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!
diff --git a/sphinx/htmlwriter.py b/sphinx/htmlwriter.py
index 8767f73f..94b3cdb5 100644
--- a/sphinx/htmlwriter.py
+++ b/sphinx/htmlwriter.py
@@ -351,8 +351,11 @@ class SmartyPantsHTMLTranslator(HTMLTranslator):
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)