git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: gitweb: Add committags support
Date: Fri, 08 Sep 2006 22:57:59 +0200	[thread overview]
Message-ID: <edslfm$tb9$1@sea.gmane.org> (raw)
In-Reply-To: 200609081246.56423.jnareb@gmail.com

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() + ' '->'&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

      reply	other threads:[~2006-09-08 20:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-08 10:46 gitweb: Add committags support Jakub Narebski
2006-09-08 20:57 ` Jakub Narebski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='edslfm$tb9$1@sea.gmane.org' \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).