[PATCH] interhg: extension for hyperlink to BTS in changeset and changelog

Matt Mackall mpm at selenic.com
Mon Jun 25 00:44:36 CDT 2007


On Wed, Jun 20, 2007 at 12:53:49AM +0900, Hideya 'OhaC' OHASHI wrote:
> First I simply override "escape".
> But it's used from several points, So I used a magic keyword ":InterHg:".

I don't think that's a problem. escape should only be used where we're
converting user strings to HTML. A slightly stricter regex like \b#\d+
might be sufficient to avoid needing the keyword hack.
 
> +interhg::
> +  Settings for extensions that links to BTS.
> +  bts;;
> +    Base URL to use BTS. Such as Bugzilla, trac, redMine.
> +    Example: "http://www.selenic.com/mercurial/bts/issue"
> +  regexp;;
> +    Regular expression for BTS issue keywords. Default is #(\d+)
> +    Example: "issue(\d+)"
> +  format;;
> +    Print format. Default is #%%s
> +    Example: "issue%%s"

This should be a generic replacement facility. eg:

# bug tracker
pat1 = s/\b#(\d+)\b/<a href="http:\/\/bts/issue\1">#\1</a>/

# wiki links
pat2 = s/\b\[\w+\]\b/<a href="http:\/\/wiki/issue\1">#\1</a>/

etc...

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list