##// END OF EJS Templates
diffs: use custom lexer extraction in diffs to so it behaves consistently with...
marcink -
r1591:9abd8b35 default
parent child Browse files
Show More
@@ -25,7 +25,7 b' from itertools import groupby'
25 from pygments import lex
25 from pygments import lex
26 from pygments.formatters.html import _get_ttype_class as pygment_token_class
26 from pygments.formatters.html import _get_ttype_class as pygment_token_class
27 from rhodecode.lib.helpers import (
27 from rhodecode.lib.helpers import (
28 get_lexer_for_filenode, html_escape)
28 get_lexer_for_filenode, html_escape, get_custom_lexer)
29 from rhodecode.lib.utils2 import AttributeDict
29 from rhodecode.lib.utils2 import AttributeDict
30 from rhodecode.lib.vcs.nodes import FileNode
30 from rhodecode.lib.vcs.nodes import FileNode
31 from rhodecode.lib.diff_match_patch import diff_match_patch
31 from rhodecode.lib.diff_match_patch import diff_match_patch
@@ -407,8 +407,12 b' class DiffSet(object):'
407 if filename not in self._lexer_cache:
407 if filename not in self._lexer_cache:
408 if filenode:
408 if filenode:
409 lexer = filenode.lexer
409 lexer = filenode.lexer
410 extension = filenode.extension
410 else:
411 else:
411 lexer = FileNode.get_lexer(filename=filename)
412 lexer = FileNode.get_lexer(filename=filename)
413 extension = filename.split('.')[-1]
414
415 lexer = get_custom_lexer(extension) or lexer
412 self._lexer_cache[filename] = lexer
416 self._lexer_cache[filename] = lexer
413 return self._lexer_cache[filename]
417 return self._lexer_cache[filename]
414
418
General Comments 0
You need to be logged in to leave comments. Login now