Mercurial > hg
changeset 6194:fe54e7501de1
highlight: bail out if file is binary
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Thu, 28 Feb 2008 22:04:22 -0800 |
parents | 2344da8eb9b4 |
children | 272fd5fa576d |
files | hgext/highlight.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/highlight.py Thu Feb 28 21:35:27 2008 -0800 +++ b/hgext/highlight.py Thu Feb 28 22:04:22 2008 -0800 @@ -55,9 +55,12 @@ new_header = old_header + SYNTAX_CSS tmpl.cache['header'] = new_header + text = fctx.data() + if util.binary(text): + return + style = self.config("web", "pygments_style", "colorful") # To get multi-line strings right, we can't format line-by-line - text = fctx.data() try: lexer = guess_lexer_for_filename(fctx.path(), text, encoding=util._encoding)