Fix syntax highlighting wrt. ambiguous file extensions.
See: https://groups.google.com/forum/#!topic/klaus-users/OKyd4suHN2g
.m files may be both Matlab and Objective-C. Pygments already handles
these cases gracefully; not sure why didn't use it in the past.
Thanks to Gnewbee for the report.
Jonas Haag
11 years ago
74 | 74 | if render_markup and markup.can_render(filename): |
75 | 75 | return markup.render(filename, code) |
76 | 76 | |
77 | try: | |
78 | lexer = get_lexer_for_filename(filename) | |
79 | except ClassNotFound: | |
80 | lexer = guess_lexer(code) | |
81 | ||
77 | lexer = get_lexer_for_filename(filename, code) | |
82 | 78 | return highlight(code, lexer, KlausFormatter()) |
83 | 79 | |
84 | 80 |