diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-03 15:43:00 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-03 15:43:00 +0200 |
commit | 4c88fe5a2efc7cc6a5412966aa44fb80f19415aa (patch) | |
tree | df20e60e65d3dcf3f4cda6d9e9feea3d6f1fcb02 /highlighting.py | |
parent | 5b0e4328baa9d6563158cf894290bcaa9353ba66 (diff) | |
download | web-4c88fe5a2efc7cc6a5412966aa44fb80f19415aa.tar.gz web-4c88fe5a2efc7cc6a5412966aa44fb80f19415aa.tar.bz2 web-4c88fe5a2efc7cc6a5412966aa44fb80f19415aa.zip |
Change code to be run in a multiple-app env
Diffstat (limited to 'highlighting.py')
-rw-r--r-- | highlighting.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/highlighting.py b/highlighting.py index f859920..439ae78 100644 --- a/highlighting.py +++ b/highlighting.py @@ -7,13 +7,11 @@ formatter = HtmlFormatter(encoding = "utf-8", classprefix="pygm", nowrap=True) BashLexer.tokens["basic"].append((r'\b(emerge|layman|git(?!:))\s*\b(?!\.)', Name.Builtin)) -def highlight(context, code, lang): +def highlight(code, lang): l = get_lexer_by_name(lang, encoding = "utf-8") - context.write(pygHighlight(code, l, formatter)) - return '' + return pygHighlight(code, l, formatter) -def get_css(context): - context.write("""<style type="text/css"> +def get_css(): + return """<style type="text/css"> %s -</style>""" % formatter.get_style_defs()) - return '' +</style>""" % formatter.get_style_defs() |