diff options
| author | Georg Brandl <georg@python.org> | 2014-03-25 10:26:20 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2014-03-25 10:26:20 +0100 |
| commit | 9c7b7b98ccd649b54a9576fb658a33d6398e0f60 (patch) | |
| tree | b7363d0983d149908277b77e65aca2ee956f9794 /sphinx | |
| parent | b7004620eebd66e684730f10be25a86667330fee (diff) | |
| download | sphinx-9c7b7b98ccd649b54a9576fb658a33d6398e0f60.tar.gz | |
Closes #636: Keep straight single quotes in literal blocks in the LaTeX build.
Diffstat (limited to 'sphinx')
| -rw-r--r-- | sphinx/highlighting.py | 8 | ||||
| -rw-r--r-- | sphinx/texinputs/sphinx.sty | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index f9abb7d3..600a7cf0 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -63,6 +63,12 @@ _LATEX_STYLES = r''' \newcommand\PYGZcb{\char`\}} ''' +# used if Pygments is available +# use textcomp quote to get a true single quote +_LATEX_ADD_STYLES = r''' +\renewcommand\PYGZsq{\textquotesingle} +''' + parsing_exceptions = (SyntaxError, UnicodeEncodeError) if sys.version_info < (2, 5): # Python <= 2.4 raises MemoryError when parsing an @@ -231,4 +237,4 @@ class PygmentsBridge(object): if self.dest == 'html': return formatter.get_style_defs('.highlight') else: - return formatter.get_style_defs() + return formatter.get_style_defs() + _LATEX_ADD_STYLES diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 554845f8..ee0a923d 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -32,6 +32,8 @@ \RequirePackage{parskip} % For parsed-literal blocks. \RequirePackage{alltt} +% Display "real" single quotes in literal blocks. +\RequirePackage{upquote} % Redefine these colors to your liking in the preamble. \definecolor{TitleColor}{rgb}{0.126,0.263,0.361} |
