Show More
@@ -45,11 +45,15 b' from IPython.utils.signatures import signature' | |||
|
45 | 45 | from IPython.utils.colorable import Colorable |
|
46 | 46 | |
|
47 | 47 | from pygments import highlight |
|
48 | from pygments.lexers import PythonLexer | |
|
48 | try: | |
|
49 | # PythonLexer was renamed to Python2Lexer in pygments 2.5 | |
|
50 | from pygments.lexers import Python2Lexer | |
|
51 | except ImportError: | |
|
52 | from pygments.lexers import PythonLexer as Python2Lexer | |
|
49 | 53 | from pygments.formatters import HtmlFormatter |
|
50 | 54 | |
|
51 | 55 | def pylight(code): |
|
52 | return highlight(code, PythonLexer(), HtmlFormatter(noclasses=True)) | |
|
56 | return highlight(code, Python2Lexer(), HtmlFormatter(noclasses=True)) | |
|
53 | 57 | |
|
54 | 58 | # builtin docstrings to ignore |
|
55 | 59 | _func_call_docstring = types.FunctionType.__call__.__doc__ |
@@ -34,7 +34,12 b' This includes:' | |||
|
34 | 34 | import re |
|
35 | 35 | |
|
36 | 36 | # Third party |
|
37 |
from pygments.lexers import BashLexer, |
|
|
37 | from pygments.lexers import BashLexer, Python3Lexer | |
|
38 | try: | |
|
39 | # PythonLexer was renamed to Python2Lexer in pygments 2.5 | |
|
40 | from pygments.lexers import Python2Lexer | |
|
41 | except ImportError: | |
|
42 | from pygments.lexers import PythonLexer as Python2Lexer | |
|
38 | 43 | from pygments.lexer import ( |
|
39 | 44 | Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using, |
|
40 | 45 | ) |
@@ -87,7 +92,7 b' def build_ipy_lexer(python3):' | |||
|
87 | 92 | aliases = ['ipython3'] |
|
88 | 93 | doc = """IPython3 Lexer""" |
|
89 | 94 | else: |
|
90 | PyLexer = PythonLexer | |
|
95 | PyLexer = Python2Lexer | |
|
91 | 96 | name = 'IPython' |
|
92 | 97 | aliases = ['ipython2', 'ipython'] |
|
93 | 98 | doc = """IPython Lexer""" |
General Comments 0
You need to be logged in to leave comments.
Login now