[PATCH] syntax highlighting for hgweb file revision view
Matt Mackall
mpm at selenic.com
Tue Nov 6 17:10:48 UTC 2007
On Mon, Nov 05, 2007 at 10:35:55PM -0500, Adam Hupp wrote:
> 7 files changed, 152 insertions(+), 4 deletions(-)
> mercurial/hgweb/hgweb_mod.py | 90 ++++++++++++++++++++++++++++++++++--
> templates/filerevision.tmpl | 2
> templates/gitweb/filerevision.tmpl | 2
> templates/gitweb/map | 1
> templates/header.tmpl | 1
> templates/map | 1
> templates/static/syntax.css | 59 +++++++++++++++++++++++
>
>
> # HG changeset patch
> # User Adam Hupp <adam at hupp.org>
> # Date 1194320010 18000
> # Node ID 52815203c50687a81ee673b0a817de683b9cc7af
> # Parent 3aa5c45874c60560d75df74adbc964e107c8538a
> syntax highlighting for hgweb file revision view
>
> This changeset uses Pygments to add optional syntax highlighting to
> the file revision view of hgweb. If Pygments is not available or
> highlighting is disabled it falls back to the plain view.
This looks like a good feature to put in an extension.
> Two new configuration options are added to the [web] section:
>
> use_pygments: if true, syntax highlighting is enabled (default: True)
>
> pygments_style: the color scheme. If this is changed the css file in
> templates/static/syntax.css should be regenerated as well
> (default: colorful)
>
> diff -r 3aa5c45874c6 -r 52815203c506 mercurial/hgweb/hgweb_mod.py
> --- a/mercurial/hgweb/hgweb_mod.py Sat Oct 20 03:04:34 2007 +0200
> +++ b/mercurial/hgweb/hgweb_mod.py Mon Nov 05 22:33:30 2007 -0500
> @@ -8,11 +8,31 @@
>
> import os, mimetypes, re, zlib, mimetools, cStringIO, sys
> import tempfile, urllib, bz2
> +
> +"""
> +this prevents an "'unloaded module' object is not callable" error
> +within pygments when using guess_lexer_for_filename
> +
> +based on info in http://www.selenic.com/mercurial/bts/issue605
> +"""
> +import mercurial.demandimport
> +mercurial.demandimport.disable()
That's not an acceptable fix here. Adding the module in question to
the demandimport blacklist would be better.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list