[PATCH] highlight: Generate pygments style sheet dynamically

Dirkjan Ochtman dirkjan at ochtman.nl
Fri Apr 4 13:44:35 CDT 2008


Isaac Jurado wrote:
> @@ -35,7 +32,7 @@ from pygments.lexers import guess_lexer,
>  from pygments.lexers import guess_lexer, guess_lexer_for_filename, TextLexer
>  from pygments.formatters import HtmlFormatter
>  
> -SYNTAX_CSS = ('\n<link rel="stylesheet" href="#staticurl#highlight.css" '
> +SYNTAX_CSS = ('\n<link rel="stylesheet" href="/pygments_css" '
>                'type="text/css" />')
>  
>  def pygmentize(field, fctx, style, tmpl):

I think you still need something like {urlbase} before /pygments_css.

FWIW, one of the Pygments committers mentioned in IRC that generating 
this stylesheet is cheap, so I think dynamically generating is nice.

(Certainly, this is much better than including 13 stylesheets.)

Cheers,

Dirkjan



More information about the Mercurial-devel mailing list