mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add missing commands if Pygments is not installed.
Bug reported by Ondrej Certik.
This commit is contained in:
parent
0de9d7db7a
commit
3135d3802d
3
CHANGES
3
CHANGES
@ -11,6 +11,9 @@ Changes in trunk
|
||||
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)
|
||||
================================
|
||||
|
@ -65,6 +65,13 @@ def escape_tex(text):
|
||||
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):
|
||||
@ -139,5 +146,9 @@ class PygmentsBridge(object):
|
||||
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user