##// END OF EJS Templates
Clean up aliases for lexers.
chebee7i -
Show More
@@ -83,7 +83,7 b' def build_ipy_lexer(python3):'
83 PyLexer = PythonLexer
83 PyLexer = PythonLexer
84 clsname = 'IPythonLexer'
84 clsname = 'IPythonLexer'
85 name = 'IPython'
85 name = 'IPython'
86 aliases = ['ipython']
86 aliases = ['ipython2', 'ipython']
87 doc = """IPython Lexer"""
87 doc = """IPython Lexer"""
88
88
89 tokens = PyLexer.tokens.copy()
89 tokens = PyLexer.tokens.copy()
@@ -169,6 +169,10 b' class IPythonTracebackLexer(DelegatingLexer):'
169
169
170 def __init__(self, **options):
170 def __init__(self, **options):
171 self.python3 = get_bool_opt(options, 'python3', False)
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 if self.python3:
177 if self.python3:
174 IPyLexer = IPython3Lexer
178 IPyLexer = IPython3Lexer
@@ -255,6 +259,10 b' class IPythonConsoleLexer(Lexer):'
255
259
256 """
260 """
257 self.python3 = get_bool_opt(options, 'python3', False)
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 in1_regex = options.get('in1_regex', self.in1_regex)
267 in1_regex = options.get('in1_regex', self.in1_regex)
260 in2_regex = options.get('in2_regex', self.in2_regex)
268 in2_regex = options.get('in2_regex', self.in2_regex)
@@ -479,6 +487,11 b' class IPyLexer(Lexer):'
479
487
480 def __init__(self, **options):
488 def __init__(self, **options):
481 self.python3 = get_bool_opt(options, 'python3', False)
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 Lexer.__init__(self, **options)
495 Lexer.__init__(self, **options)
483
496
484 self.IPythonLexer = IPythonLexer(**options)
497 self.IPythonLexer = IPythonLexer(**options)
@@ -19,9 +19,9 b' def setup(app):'
19 # Alternatively, we could register the lexer with pygments instead. This would
19 # Alternatively, we could register the lexer with pygments instead. This would
20 # require using setuptools entrypoints: http://pygments.org/docs/plugins
20 # require using setuptools entrypoints: http://pygments.org/docs/plugins
21
21
22 ipy = IPyLexer(python3=False)
22 ipy2 = IPyLexer(python3=False)
23 ipy3 = IPyLexer(python3=True)
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 highlighting.lexers['ipython3'] = ipy3
27 highlighting.lexers['ipython3'] = ipy3
General Comments 0
You need to be logged in to leave comments. Login now