diff options
Diffstat (limited to 'pygments/lexers')
-rw-r--r-- | pygments/lexers/__init__.py | 8 | ||||
-rw-r--r-- | pygments/lexers/templates.py | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py index 529e3cb3..9ae4baf9 100644 --- a/pygments/lexers/__init__.py +++ b/pygments/lexers/__init__.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- ++# -*- coding: utf-8 -*- """ pygments.lexers ~~~~~~~~~~~~~~~ @@ -68,7 +68,7 @@ def get_lexer_for_filename(_fn, **options): for cls in find_plugin_lexers(): for filename in cls.filenames: if fnmatch.fnmatch(_fn, filename): - return lexer(**options) + return cls(**options) raise ValueError('no lexer for filename %r found' % _fn) @@ -83,7 +83,7 @@ def get_lexer_for_mimetype(_mime, **options): return _lexer_cache[name](**options) for cls in find_plugin_lexers(): if _mime in cls.mimetypes: - return lexer(**options) + return cls(**options) raise ValueError('no lexer for mimetype %r found' % _mime) @@ -150,7 +150,7 @@ def guess_lexer(_text, **options): # better guess_lexer_for_filename function. best_lexer = [0.0, None] for lexer in _iter_lexerclasses(): - rv = lexer.analyse_text(text) + rv = lexer.analyse_text(_text) if rv == 1.0: return lexer(**options) if rv > best_lexer[0]: diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py index 09454f2b..666bd5a7 100644 --- a/pygments/lexers/templates.py +++ b/pygments/lexers/templates.py @@ -21,7 +21,7 @@ from pygments.lexers.agile import PythonLexer from pygments.lexer import \ Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, \ include, using -from pygments.token import \ +from pygments.token import Error, \ Text, Comment, Operator, Keyword, Name, String, Number, Other from pygments.util import html_doctype_matches, looks_like_xml |