comparison hgext/highlight/__init__.py @ 9409:57157a224037

highlight: move code from module top-level into extsetup
author Martin Geisler <mg@lazybytes.net>
date Fri, 28 Aug 2009 22:14:04 +0200
parents 917e1d5674d6
children 25e572394f5c
comparison
equal deleted inserted replaced
9408:70bf7f853adc 9409:57157a224037
51 pg_style = web.config('web', 'pygments_style', 'colorful') 51 pg_style = web.config('web', 'pygments_style', 'colorful')
52 fmter = highlight.HtmlFormatter(style = pg_style) 52 fmter = highlight.HtmlFormatter(style = pg_style)
53 req.respond(common.HTTP_OK, 'text/css') 53 req.respond(common.HTTP_OK, 'text/css')
54 return ['/* pygments_style = %s */\n\n' % pg_style, fmter.get_style_defs('')] 54 return ['/* pygments_style = %s */\n\n' % pg_style, fmter.get_style_defs('')]
55 55
56 # monkeypatch in the new version 56 def extsetup():
57 extensions.wrapfunction(webcommands, '_filerevision', filerevision_highlight) 57 # monkeypatch in the new version
58 extensions.wrapfunction(webcommands, 'annotate', annotate_highlight) 58 extensions.wrapfunction(webcommands, '_filerevision', filerevision_highlight)
59 webcommands.highlightcss = generate_css 59 extensions.wrapfunction(webcommands, 'annotate', annotate_highlight)
60 webcommands.__all__.append('highlightcss') 60 webcommands.highlightcss = generate_css
61 webcommands.__all__.append('highlightcss')