Commits

Anonymous committed 5938262

Add missing commands if Pygments is not installed.
Bug reported by Ondrej Certik.

Comments (0)

Files changed (2)

   files (under _sources) as input files if the source suffix is
   ``.txt``.
 
+* sphinx.highlighting: Generate correct markup for LaTeX Verbatim
+  environment escapes even if Pygments is not installed.
+
 
 Release 0.1.61798 (Mar 23, 2008)
 ================================

sphinx/highlighting.py

                 replace('\x01', '@lb[]').\
                 replace('\x02', '@rb[]')
 
+# used if Pygments is not available
+_LATEX_STYLES = r'''
+\newcommand\at{@}
+\newcommand\lb{[}
+\newcommand\rb{]}
+'''
+
 
 parsing_exceptions = (SyntaxError, UnicodeEncodeError)
 if sys.version_info < (2, 5):
 
     def get_stylesheet(self):
         if not pygments:
+            if self.dest == 'latex':
+                return _LATEX_STYLES
+            # no HTML styles needed
             return ''
-        return (self.dest == 'html' and self.hfmter or self.lfmter)[0].get_style_defs()
+        fmter = (self.dest == 'html' and self.hfmter or self.lfmter)[0]
+        return fmter.get_style_defs()