Re: gitweb: Add committags support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jakub Narebski wrote:

> 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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]