Mercurial > hg-stable
changeset 5991:31726c27e40e
highlight: update according to latest hgweb_mod changes
Also move encoding workaround completely into non binary condition.
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Thu, 31 Jan 2008 13:57:48 +0100 |
parents | 71d675f4b1f8 |
children | 30c40ba10963 |
files | hgext/highlight.py |
diffstat | 1 files changed, 4 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/highlight.py Fri Feb 01 00:25:32 2008 +0100 +++ b/hgext/highlight.py Thu Jan 31 13:57:48 2008 +0100 @@ -85,28 +85,18 @@ def filerevision_pygments(self, tmpl, fctx): """Reimplement hgweb.filerevision to use syntax highlighting""" f = fctx.path() - - rawtext = fctx.data() - text = rawtext - + text = fctx.data() fl = fctx.filelog() n = fctx.filenode() - mt = mimetypes.guess_type(f)[0] - - # we always want hgweb.encoding - util._encoding = self.encoding - if util.binary(text): - mt = mt or 'application/octet-stream' + mt = mimetypes.guess_type(f)[0] or 'application/octet-stream' text = "(binary:%s)" % mt - # don't parse (binary:...) as anything forcetext = True else: - mt = mt or 'text/plain' - # encode to hgweb.encoding for lexers and formatter + util._encoding = self.encoding text = util.tolocal(text) forcetext = False @@ -128,12 +118,10 @@ new_header = old_header + SYNTAX_CSS tmpl.cache['header'] = new_header - yield tmpl("filerevision", + return tmpl("filerevision", file=f, path=hgweb_mod._up(f), # fixme: make public text=text_formatted, - raw=rawtext, - mimetype=mt, rev=fctx.rev(), node=hex(fctx.node()), author=fctx.user(),