Fixed get_lexer()

This commit is contained in:
Jakub Roztocil 2016-03-01 16:55:12 +08:00
parent e83e554ffb
commit 4f8d6c013b

View File

@ -41,9 +41,6 @@ class ColorFormatter(FormatterPlugin):
# --json, -j # --json, -j
self.explicit_json = explicit_json self.explicit_json = explicit_json
# Cache to speed things up when we process streamed body by line.
self.lexer_cache = {}
try: try:
style_class = pygments.styles.get_style_by_name(color_scheme) style_class = pygments.styles.get_style_by_name(color_scheme)
except ClassNotFound: except ClassNotFound:
@ -65,7 +62,11 @@ class ColorFormatter(FormatterPlugin):
return body.strip() return body.strip()
def get_lexer(self, mime, body): def get_lexer(self, mime, body):
return get_lexer(mime, body, self.explicit_json) return get_lexer(
mime=mime,
explicit_json=self.explicit_json,
body=body,
)
def get_lexer(mime, explicit_json=False, body=''): def get_lexer(mime, explicit_json=False, body=''):