Fix a bug where smartypants was used for attribute values.

This commit is contained in:
Georg Brandl 2008-04-27 19:53:27 +00:00
parent 262edb1413
commit 20b6be23e9
2 changed files with 10 additions and 5 deletions

View File

@ -91,6 +91,8 @@ Bugs fixed
* sphinx.htmlwriter: Don't use os.path for joining image HREFs. * 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 * sphinx.latexwriter: Implement option lists. Also, some other changes
were made to ``sphinx.sty`` in order to enhance compatibility and were made to ``sphinx.sty`` in order to enhance compatibility and
remove old unused stuff. Thanks to Gael Varoquaux for that! remove old unused stuff. Thanks to Gael Varoquaux for that!

View File

@ -351,8 +351,11 @@ class SmartyPantsHTMLTranslator(HTMLTranslator):
finally: finally:
self.no_smarty -= 1 self.no_smarty -= 1
def encode(self, text): def visit_Text(self, node):
text = HTMLTranslator.encode(self, text) text = node.astext()
if self.no_smarty <= 0: encoded = self.encode(text)
text = sphinx_smarty_pants(text) if self.in_mailto and self.settings.cloak_email_addresses:
return text encoded = self.cloak_email(encoded)
elif self.no_smarty <= 0:
encoded = sphinx_smarty_pants(encoded)
self.body.append(encoded)