Show More
@@ -83,7 +83,7 def build_ipy_lexer(python3): | |||
|
83 | 83 | PyLexer = PythonLexer |
|
84 | 84 | clsname = 'IPythonLexer' |
|
85 | 85 | name = 'IPython' |
|
86 | aliases = ['ipython'] | |
|
86 | aliases = ['ipython2', 'ipython'] | |
|
87 | 87 | doc = """IPython Lexer""" |
|
88 | 88 | |
|
89 | 89 | tokens = PyLexer.tokens.copy() |
@@ -169,6 +169,10 class IPythonTracebackLexer(DelegatingLexer): | |||
|
169 | 169 | |
|
170 | 170 | def __init__(self, **options): |
|
171 | 171 | self.python3 = get_bool_opt(options, 'python3', False) |
|
172 | if self.python3: | |
|
173 | self.aliases = ['ipythontb3'] | |
|
174 | else: | |
|
175 | self.aliases = ['ipythontb2', 'ipythontb'] | |
|
172 | 176 | |
|
173 | 177 | if self.python3: |
|
174 | 178 | IPyLexer = IPython3Lexer |
@@ -255,6 +259,10 class IPythonConsoleLexer(Lexer): | |||
|
255 | 259 | |
|
256 | 260 | """ |
|
257 | 261 | self.python3 = get_bool_opt(options, 'python3', False) |
|
262 | if self.python3: | |
|
263 | self.aliases = ['ipythoncon3'] | |
|
264 | else: | |
|
265 | self.aliases = ['ipythoncon2', 'ipythoncon'] | |
|
258 | 266 | |
|
259 | 267 | in1_regex = options.get('in1_regex', self.in1_regex) |
|
260 | 268 | in2_regex = options.get('in2_regex', self.in2_regex) |
@@ -479,6 +487,11 class IPyLexer(Lexer): | |||
|
479 | 487 | |
|
480 | 488 | def __init__(self, **options): |
|
481 | 489 | self.python3 = get_bool_opt(options, 'python3', False) |
|
490 | if self.python3: | |
|
491 | self.aliases = ['ipy3'] | |
|
492 | else: | |
|
493 | self.aliases = ['ipy2', 'ipy'] | |
|
494 | ||
|
482 | 495 | Lexer.__init__(self, **options) |
|
483 | 496 | |
|
484 | 497 | self.IPythonLexer = IPythonLexer(**options) |
@@ -19,9 +19,9 def setup(app): | |||
|
19 | 19 | # Alternatively, we could register the lexer with pygments instead. This would |
|
20 | 20 | # require using setuptools entrypoints: http://pygments.org/docs/plugins |
|
21 | 21 | |
|
22 | ipy = IPyLexer(python3=False) | |
|
22 | ipy2 = IPyLexer(python3=False) | |
|
23 | 23 | ipy3 = IPyLexer(python3=True) |
|
24 | ipy3.aliases = ['ipy3'] | |
|
25 | 24 | |
|
26 | highlighting.lexers['ipython'] = ipy | |
|
25 | highlighting.lexers['ipython'] = ipy2 | |
|
26 | highlighting.lexers['ipython2'] = ipy2 | |
|
27 | 27 | highlighting.lexers['ipython3'] = ipy3 |
General Comments 0
You need to be logged in to leave comments.
Login now