{"thread":{"id":"43337","subject":"Re: [PATCH] gitweb: make HTML links out of http/https URLs in changelogs","startedAt":"2006-11-21T22:02:36Z","lastAt":"2006-11-22T20:56:52Z","messageCount":6,"participants":["Petr Baudis","Randal L. Schwartz","Jakub Narebski","Kir Kolyshkin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"298623","messageId":"4563777C.4050108@openvz.org","threadId":"43337","inReplyTo":null,"subject":"[PATCH] gitweb: make HTML links out of http/https URLs in changelogs","fromName":"Kir Kolyshkin","fromEmail":"kir@openvz.org","sentAt":"2006-11-21T22:02:36Z","receivedAt":"2006-11-21T22:02:36Z","isPatch":true,"sender":{"key":"kir@openvz.org","avatar":null},"body":"It is a common practice to put links to bugzillas, mailing lists, etc. \nin git log entries. The fact that gitweb doesn't make HTML links out of \nthat URLs makes following those URLs inconvenient. This patch fixes that \nproblem, trying to address cases when URL is enclosed in round or square \nbrackets.\n\nSlightly tested on http://git.openvz.org/. Applicable to git-1.4.4.\n\nSigned-off-by: Kir Kolyshkin <kir@openvz.org>\n---\n gitweb/gitweb.perl |    2 ++\n 1 file changed, 2 insertions(+)\n\n--- git-1.4.4/gitweb/gitweb.perl\t2006-11-15 08:22:27.000000000 +0100\n+++ git-1.4.4-my/gitweb/gitweb.perl\t2006-11-21 22:49:14.000000000 +0100\n@@ -828,6 +828,8 @@\n \t\t\t$line =~ s/$hash_text/$link/;\n \t\t}\n \t}\n+\t# make HTML links out of http(s) URLs\n+\t$line =~ s/(http[s]?:\\/\\/[^[:space:]\\]\\)]+)/<a href=\"\\1\">\\1<\\/a>/g;\n \treturn $line;\n }\n \n\n"},{"id":"296007","messageId":"ejvuf4$4v4$1@sea.gmane.org","threadId":"43337","inReplyTo":"4563777C.4050108@openvz.org","subject":"Re: [PATCH] gitweb: make HTML links out of http/https URLs in changelogs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-21T22:28:17Z","receivedAt":"2006-11-21T22:28:17Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Kir Kolyshkin wrote:\n\n> It is a common practice to put links to bugzillas, mailing lists, etc. \n> in git log entries. The fact that gitweb doesn't make HTML links out of \n> that URLs makes following those URLs inconvenient. This patch fixes that \n> problem, trying to address cases when URL is enclosed in round or square \n> brackets.\n\nPreliminary committags support was sent as an RFC patch on git mailing list\nonce. Hyperlinking plain text http, https, ftp, ftps links etc. is a special\ncase of committag. That wha is implemented now, namely hyperlinking\ncommitsha to commit view is also special case of comittag.\n\nAnd I plan to implement it, only later. But you are welcome to do it\ninstead.\n\ngitweb-xmms2 http://git.xmms.se/?p=gitweb-xmms2.git has xmms2 related\ncommittags support (links to xmms2 Mantis bugtracker from BUG(n) and\nFEATURE(n))\n \n> Slightly tested on http://git.openvz.org/. Applicable to git-1.4.4.\n> \n> Signed-off-by: Kir Kolyshkin <kir@openvz.org>\n> ---\n>  gitweb/gitweb.perl |    2 ++\n>  1 file changed, 2 insertions(+)\n> \n> --- git-1.4.4/gitweb/gitweb.perl      2006-11-15 08:22:27.000000000 +0100\n> +++ git-1.4.4-my/gitweb/gitweb.perl   2006-11-21 22:49:14.000000000 +0100\n> @@ -828,6 +828,8 @@\n\nCould you please send patches created by git tools, namely git-format-patch,\nor if you really need to send GNU diff patches, use -p option? It really\nhelps in patch review.\n\n>                       $line =~ s/$hash_text/$link/;\n>               }\n>       }\n> +     # make HTML links out of http(s) URLs\n> +     $line =~ s/(http[s]?:\\/\\/[^[:space:]\\]\\)]+)/<a href=\"\\1\">\\1<\\/a>/g;\n>       return $line;\n>  }\n\nWont work correctly if commit message has sha1 of commit in it; it would be\nchanged to \n <a href=\"$my_uri?p=$project;a=commit;h=$hash_text\" class=\"text\">$hash_text</a>\nthen the code you added will add hyperlink in place of href value (!).\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"295439","messageId":"86wt5oicdj.fsf@blue.stonehenge.com","threadId":"43337","inReplyTo":"4563777C.4050108@openvz.org","subject":"Re: [PATCH] gitweb: make HTML links out of http/https URLs in changelogs","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2006-11-21T23:55:04Z","receivedAt":"2006-11-21T23:55:04Z","isPatch":true,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Kir\" == Kir Kolyshkin <kir@openvz.org> writes:\n\nKir> +\t# make HTML links out of http(s) URLs\nKir> +\t$line =~ s/(http[s]?:\\/\\/[^[:space:]\\]\\)]+)/<a href=\"\\1\">\\1<\\/a>/g;\n\nPerl tip of the day:\n\nOn the right side of s///, you want $1, not \\1, because \\1 accidentally\nworks, but \\10 (instead of the proper $10) will give you a control-h.  Ick.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\n"},{"id":"296031","messageId":"20061122000655.GJ7201@pasky.or.cz","threadId":"43337","inReplyTo":"4563777C.4050108@openvz.org","subject":"Re: [PATCH] gitweb: make HTML links out of http/https URLs in changelogs","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-22T00:06:55Z","receivedAt":"2006-11-22T00:06:55Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Tue, Nov 21, 2006 at 11:02:36PM CET, Kir Kolyshkin wrote:\n> Slightly tested on http://git.openvz.org/. Applicable to git-1.4.4.\n\n...but in git's gitweb view it will make this <a\nhref=\"http://git.openvz.org/.\">http://git.openvz.org/.</a>. :-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nThe meaning of Stonehenge in Traflamadorian, when viewed from above, is:\n\"Replacement part being rushed with all possible speed.\"\n"},{"id":"296993","messageId":"45641195.2000804@openvz.org","threadId":"43337","inReplyTo":"20061122000655.GJ7201@pasky.or.cz","subject":"Re: [PATCH] gitweb: make HTML links out of http/https URLs in changelogs","fromName":"Kir Kolyshkin","fromEmail":"kir@openvz.org","sentAt":"2006-11-22T09:00:05Z","receivedAt":"2006-11-22T09:00:05Z","isPatch":true,"sender":{"key":"kir@openvz.org","avatar":null},"body":"Petr Baudis wrote:\n> On Tue, Nov 21, 2006 at 11:02:36PM CET, Kir Kolyshkin wrote:\n>   \n>> Slightly tested on http://git.openvz.org/. Applicable to git-1.4.4.\n>>     \n>\n> ...but in git's gitweb view it will make this <a\n> href=\"http://git.openvz.org/.\">http://git.openvz.org/.</a>. :-)\nNot a problem actually since \".\" means \"current directory\", so it will \nwork fine (and I have checked that) :)\nSure there is a room for improvement for this regex -- and I am \ncollecting those.\n\n"},{"id":"294402","messageId":"20061122205652.GL7201@pasky.or.cz","threadId":"43337","inReplyTo":"45641195.2000804@openvz.org","subject":"Re: [PATCH] gitweb: make HTML links out of http/https URLs in changelogs","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-22T20:56:52Z","receivedAt":"2006-11-22T20:56:52Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Wed, Nov 22, 2006 at 10:00:05AM CET, Kir Kolyshkin wrote:\n> Petr Baudis wrote:\n> >On Tue, Nov 21, 2006 at 11:02:36PM CET, Kir Kolyshkin wrote:\n> >  \n> >>Slightly tested on http://git.openvz.org/. Applicable to git-1.4.4.\n> >>    \n> >\n> >...but in git's gitweb view it will make this <a\n> >href=\"http://git.openvz.org/.\">http://git.openvz.org/.</a>. :-)\n> Not a problem actually since \".\" means \"current directory\", so it will \n> work fine (and I have checked that) :)\n> Sure there is a room for improvement for this regex -- and I am \n> collecting those.\n\nBut \"http://git.openvz.org/index.html.\" might not work so fine, nor\n\"http://git.openvz.org/,\"...\n\nBad URLs matchers which don't snip unlikely (!= invalid!) characters\nfrom the end of the URL are my pet peeve. ;-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nThe meaning of Stonehenge in Traflamadorian, when viewed from above, is:\n\"Replacement part being rushed with all possible speed.\"\n"}]}