hgext/highlight/__init__.py
changeset 25602 85fb416f2fa7
parent 25186 80c5b2666a96
child 26249 3166bcc0c538
equal deleted inserted replaced
25601:3ec8351fa6ed 25602:85fb416f2fa7
    28 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    28 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    29 # be specifying the version(s) of Mercurial they are tested with, or
    29 # be specifying the version(s) of Mercurial they are tested with, or
    30 # leave the attribute unspecified.
    30 # leave the attribute unspecified.
    31 testedwith = 'internal'
    31 testedwith = 'internal'
    32 
    32 
    33 def filerevision_highlight(orig, web, tmpl, fctx):
    33 def filerevision_highlight(orig, web, req, tmpl, fctx):
    34     mt = ''.join(tmpl('mimetype', encoding=encoding.encoding))
    34     mt = ''.join(tmpl('mimetype', encoding=encoding.encoding))
    35     # only pygmentize for mimetype containing 'html' so we both match
    35     # only pygmentize for mimetype containing 'html' so we both match
    36     # 'text/html' and possibly 'application/xhtml+xml' in the future
    36     # 'text/html' and possibly 'application/xhtml+xml' in the future
    37     # so that we don't have to touch the extension when the mimetype
    37     # so that we don't have to touch the extension when the mimetype
    38     # for a template changes; also hgweb optimizes the case that a
    38     # for a template changes; also hgweb optimizes the case that a
    40     # can't clash with the file's content-type here in case we
    40     # can't clash with the file's content-type here in case we
    41     # pygmentize a html file
    41     # pygmentize a html file
    42     if 'html' in mt:
    42     if 'html' in mt:
    43         style = web.config('web', 'pygments_style', 'colorful')
    43         style = web.config('web', 'pygments_style', 'colorful')
    44         highlight.pygmentize('fileline', fctx, style, tmpl)
    44         highlight.pygmentize('fileline', fctx, style, tmpl)
    45     return orig(web, tmpl, fctx)
    45     return orig(web, req, tmpl, fctx)
    46 
    46 
    47 def annotate_highlight(orig, web, req, tmpl):
    47 def annotate_highlight(orig, web, req, tmpl):
    48     mt = ''.join(tmpl('mimetype', encoding=encoding.encoding))
    48     mt = ''.join(tmpl('mimetype', encoding=encoding.encoding))
    49     if 'html' in mt:
    49     if 'html' in mt:
    50         fctx = webutil.filectx(web.repo, req)
    50         fctx = webutil.filectx(web.repo, req)