From ecb5f4c6930b08fd91faa1c112eb210d8ca04902 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 2 Sep 2008 19:49:23 +0000 Subject: [PATCH] Fixed the documentation HTML writer to not apply smartypants to literal blocks. Fixes #8696; thanks, ramiro. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8875 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/_ext/djangodocs.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py index 560cae7ac7..5640016502 100644 --- a/docs/_ext/djangodocs.py +++ b/docs/_ext/djangodocs.py @@ -89,6 +89,17 @@ class DjangoHTMLTranslator(sphinx.htmlwriter.SmartyPantsHTMLTranslator): self.body.append(')') pass + # + # Don't apply smartypants to literal blocks + # + def visit_literal_block(self, node): + self.no_smarty += 1 + sphinx.htmlwriter.SmartyPantsHTMLTranslator.visit_literal_block(self, node) + + def depart_literal_block(self, node): + sphinx.htmlwriter.SmartyPantsHTMLTranslator.depart_literal_block(self, node) + self.no_smarty -= 1 + # # Turn the "new in version" stuff (versoinadded/versionchanged) into a # better callout -- the Sphinx default is just a little span,