##// END OF EJS Templates
highlight: use matcher API to test if file should be pygmentized...
Yuya Nishihara -
r38710:2570dca0 default
parent child Browse files
Show More
@@ -36,7 +36,6 b' from mercurial.hgweb import ('
36
36
37 from mercurial import (
37 from mercurial import (
38 extensions,
38 extensions,
39 fileset,
40 )
39 )
41
40
42 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
41 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
@@ -51,9 +50,8 b' def pygmentize(web, field, fctx, tmpl):'
51 filenameonly = web.configbool('web', 'highlightonlymatchfilename', False)
50 filenameonly = web.configbool('web', 'highlightonlymatchfilename', False)
52
51
53 ctx = fctx.changectx()
52 ctx = fctx.changectx()
54 tree = fileset.parse(expr)
53 m = ctx.matchfileset(expr)
55 mctx = fileset.matchctx(ctx, subset=[fctx.path()], status=None)
54 if m(fctx.path()):
56 if fctx.path() in fileset.getset(mctx, tree):
57 highlight.pygmentize(field, fctx, style, tmpl,
55 highlight.pygmentize(field, fctx, style, tmpl,
58 guessfilenameonly=filenameonly)
56 guessfilenameonly=filenameonly)
59
57
General Comments 0
You need to be logged in to leave comments. Login now