git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: gitweb: Add committags support

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 8, 2006, 20:57 UTC
Message-ID
<edslfm$tb9$1@sea.gmane.org>
In-Reply-To
<200609081246.56423.jnareb@gmail.com>
Jakub Narebski wrote:
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() + ' '->'&nbsp;' 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
Previous: Jakub Narebski
Message 2 of 2 in “gitweb: Add committags support”
  1. Jakub NarebskiSep 8, 2006
  2. Jakub NarebskiSep 8, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.