##// END OF EJS Templates
highlight: peek Content-Type header set by hgweb...
Yuya Nishihara -
r37036:3e74d3cc default
parent child Browse files
Show More
@@ -35,7 +35,6 b' from mercurial.hgweb import ('
35 )
35 )
36
36
37 from mercurial import (
37 from mercurial import (
38 encoding,
39 extensions,
38 extensions,
40 fileset,
39 fileset,
41 )
40 )
@@ -59,7 +58,7 b' def pygmentize(web, field, fctx, tmpl):'
59 guessfilenameonly=filenameonly)
58 guessfilenameonly=filenameonly)
60
59
61 def filerevision_highlight(orig, web, fctx):
60 def filerevision_highlight(orig, web, fctx):
62 mt = ''.join(web.tmpl('mimetype', encoding=encoding.encoding))
61 mt = web.res.headers['Content-Type']
63 # only pygmentize for mimetype containing 'html' so we both match
62 # only pygmentize for mimetype containing 'html' so we both match
64 # 'text/html' and possibly 'application/xhtml+xml' in the future
63 # 'text/html' and possibly 'application/xhtml+xml' in the future
65 # so that we don't have to touch the extension when the mimetype
64 # so that we don't have to touch the extension when the mimetype
@@ -73,7 +72,7 b' def filerevision_highlight(orig, web, fc'
73 return orig(web, fctx)
72 return orig(web, fctx)
74
73
75 def annotate_highlight(orig, web):
74 def annotate_highlight(orig, web):
76 mt = ''.join(web.tmpl('mimetype', encoding=encoding.encoding))
75 mt = web.res.headers['Content-Type']
77 if 'html' in mt:
76 if 'html' in mt:
78 fctx = webutil.filectx(web.repo, web.req)
77 fctx = webutil.filectx(web.repo, web.req)
79 pygmentize(web, 'annotateline', fctx, web.tmpl)
78 pygmentize(web, 'annotateline', fctx, web.tmpl)
General Comments 0
You need to be logged in to leave comments. Login now