git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: make HTML links out of http/https URLs in changelogs
Date: Tue, 21 Nov 2006 23:28:17 +0100	[thread overview]
Message-ID: <ejvuf4$4v4$1@sea.gmane.org> (raw)
In-Reply-To: 4563777C.4050108@openvz.org

Kir Kolyshkin wrote:

> It is a common practice to put links to bugzillas, mailing lists, etc. 
> in git log entries. The fact that gitweb doesn't make HTML links out of 
> that URLs makes following those URLs inconvenient. This patch fixes that 
> problem, trying to address cases when URL is enclosed in round or square 
> brackets.

Preliminary committags support was sent as an RFC patch on git mailing list
once. Hyperlinking plain text http, https, ftp, ftps links etc. is a special
case of committag. That wha is implemented now, namely hyperlinking
commitsha to commit view is also special case of comittag.

And I plan to implement it, only later. But you are welcome to do it
instead.

gitweb-xmms2 http://git.xmms.se/?p=gitweb-xmms2.git has xmms2 related
committags support (links to xmms2 Mantis bugtracker from BUG(n) and
FEATURE(n))
 
> Slightly tested on http://git.openvz.org/. Applicable to git-1.4.4.
> 
> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
> ---
>  gitweb/gitweb.perl |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- git-1.4.4/gitweb/gitweb.perl      2006-11-15 08:22:27.000000000 +0100
> +++ git-1.4.4-my/gitweb/gitweb.perl   2006-11-21 22:49:14.000000000 +0100
> @@ -828,6 +828,8 @@

Could you please send patches created by git tools, namely git-format-patch,
or if you really need to send GNU diff patches, use -p option? It really
helps in patch review.

>                       $line =~ s/$hash_text/$link/;
>               }
>       }
> +     # make HTML links out of http(s) URLs
> +     $line =~ s/(http[s]?:\/\/[^[:space:]\]\)]+)/<a href="\1">\1<\/a>/g;
>       return $line;
>  }

Wont work correctly if commit message has sha1 of commit in it; it would be
changed to 
 <a href="$my_uri?p=$project;a=commit;h=$hash_text" class="text">$hash_text</a>
then the code you added will add hyperlink in place of href value (!).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


  reply	other threads:[~2006-11-21 22:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-21 22:02 [PATCH] gitweb: make HTML links out of http/https URLs in changelogs Kir Kolyshkin
2006-11-21 22:28 ` Jakub Narebski [this message]
2006-11-21 23:55 ` Randal L. Schwartz
2006-11-22  0:06 ` Petr Baudis
2006-11-22  9:00   ` Kir Kolyshkin
2006-11-22 20:56     ` Petr Baudis

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='ejvuf4$4v4$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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).