mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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:
@@ -21,6 +21,7 @@ except ImportError:
|
|||||||
parser = None
|
parser = None
|
||||||
|
|
||||||
from sphinx.util.texescape import tex_hl_escape_map_old, tex_hl_escape_map_new
|
from sphinx.util.texescape import tex_hl_escape_map_old, tex_hl_escape_map_new
|
||||||
|
from sphinx.ext import doctest
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pygments
|
import pygments
|
||||||
@@ -64,8 +65,6 @@ _LATEX_STYLES = r'''
|
|||||||
\newcommand\PYGZrb{]}
|
\newcommand\PYGZrb{]}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
doctestopt_re = re.compile(r'#\s*doctest:.+$', re.MULTILINE)
|
|
||||||
|
|
||||||
parsing_exceptions = (SyntaxError, UnicodeEncodeError)
|
parsing_exceptions = (SyntaxError, UnicodeEncodeError)
|
||||||
if sys.version_info < (2, 5):
|
if sys.version_info < (2, 5):
|
||||||
# Python <= 2.4 raises MemoryError when parsing an
|
# Python <= 2.4 raises MemoryError when parsing an
|
||||||
@@ -196,7 +195,8 @@ class PygmentsBridge(object):
|
|||||||
|
|
||||||
# trim doctest options if wanted
|
# trim doctest options if wanted
|
||||||
if isinstance(lexer, PythonConsoleLexer) and self.trim_doctest_flags:
|
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
|
# highlight via Pygments
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user