Georg Brandl avatar Georg Brandl committed 799899b

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.

Comments (0)

Files changed (1)

sphinx/highlighting.py

     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
 \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
 
         # 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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.