summaryrefslogtreecommitdiff
path: root/sphinx/highlighting.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r--sphinx/highlighting.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index 22f53a45b..6f22993c2 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -35,12 +35,12 @@ from pygments.util import ClassNotFound
from sphinx.pygments_styles import SphinxStyle, NoneStyle
lexers = dict(
- none = TextLexer(),
- python = PythonLexer(),
- pycon = PythonConsoleLexer(),
- pycon3 = PythonConsoleLexer(python3=True),
- rest = RstLexer(),
- c = CLexer(),
+ none = TextLexer(stripnl=False),
+ python = PythonLexer(stripnl=False),
+ pycon = PythonConsoleLexer(stripnl=False),
+ pycon3 = PythonConsoleLexer(python3=True, stripnl=False),
+ rest = RstLexer(stripnl=False),
+ c = CLexer(stripnl=False),
)
for _lexer in lexers.values():
_lexer.add_filter('raiseonerror')
@@ -77,7 +77,7 @@ class PygmentsBridge(object):
else:
style = get_style_by_name(stylename)
self.trim_doctest_flags = trim_doctest_flags
- self.formatter_args = {'style' : style}
+ self.formatter_args = {'style': style}
if dest == 'html':
self.formatter = self.html_formatter
else:
@@ -114,7 +114,7 @@ class PygmentsBridge(object):
src = src.replace("...", mark)
# lines beginning with "..." are probably placeholders for suite
- src = re.sub(r"(?m)^(\s*)" + mark + "(.)", r"\1"+ mark + r"# \2", src)
+ src = re.sub(r"(?m)^(\s*)" + mark + "(.)", r"\1" + mark + r"# \2", src)
if PY2 and isinstance(src, text_type):
# Non-ASCII chars will only occur in string literals
@@ -164,7 +164,7 @@ class PygmentsBridge(object):
lexer = lexers[lang]
else:
try:
- lexer = lexers[lang] = get_lexer_by_name(lang, **opts or {})
+ lexer = lexers[lang] = get_lexer_by_name(lang, **(opts or {}))
except ClassNotFound:
if warn:
warn('Pygments lexer name %r is not known' % lang)