Re: gitweb: Add committags support
Show 28 quoted lines
> our %committags = (
> 'commitsha' => {
> 'pattern' => qr/[0-9a-fA-F]{40}/,
> 'sub' => sub {
> my $hash_text = shift;
> if (git_get_type($hash_text) eq "commit") {
> return
> $cgi->a({-href => href(action=>"commit", hash=>$hash_text),
> -class => "text"}, $hash_text);
> }
> return undef;
> },
> 'islink' => 1,
> },
> 'mantis' => {
> 'pattern' => qr/(BUG|FEATURE)\(\d+\)/,
> 'options' => [ 'http://bugs.xmms2.xmms.se/view.php?id=' ],
> 'sub' => sub {
> my $match = shift;
> my $URL = shift;
> my ($issue) = $match =~ /(\d+)/;
> return
> $cgi->a({-href => "$URL$issue"},
> $match);
> },
> 'islink' => 1,
> },
> );Yet another committag:
'URL' => { # simple URL, no query strings
# because of the whole esc_html() + ' '->' ' thing
'pattern' => qr!(http|ftp)s?://[a-zA-Z0-9%./]+!,
'sub' => sub {
my $url = shift;
return
$cgi->a({-href => $url},
$url); # should be perhaps shortened
},
'islink' => 1,
},--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git