changeset: 3201:2a38261315ba

tag: tip
parent: 3199:cd7b0a8d99c6
user: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
date: Sun Jan 09 20:55:13 2011 +0100
summary: Trim <BLANKLINE> just like doctest flags.
This commit is contained in:
Georg Brandl
2011-01-09 21:37:02 +01:00
parent bbd158ef27
commit ca6a5b53c9

View File

@@ -21,6 +21,7 @@ except ImportError:
parser = None
from sphinx.util.texescape import tex_hl_escape_map_old, tex_hl_escape_map_new
from sphinx.ext import doctest
try:
import pygments
@@ -64,8 +65,6 @@ _LATEX_STYLES = r'''
\newcommand\PYGZrb{]}
'''
doctestopt_re = re.compile(r'#\s*doctest:.+$', re.MULTILINE)
parsing_exceptions = (SyntaxError, UnicodeEncodeError)
if sys.version_info < (2, 5):
# Python <= 2.4 raises MemoryError when parsing an
@@ -196,7 +195,8 @@ class PygmentsBridge(object):
# trim doctest options if wanted
if isinstance(lexer, PythonConsoleLexer) and self.trim_doctest_flags:
source = doctestopt_re.sub('', source)
source = doctest.blankline_re.sub('', source)
source = doctest.doctestopt_re.sub('', source)
# highlight via Pygments
try: