[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnatsweb patches
From: |
Gerald Pfeifer |
Subject: |
Re: gnatsweb patches |
Date: |
Thu, 8 Feb 2001 11:50:06 +0100 (CET) |
On 10 Jan 2001, Tom Tromey wrote:
> Gerald Pfeifer asked me to submit my gnatsweb.pl changes here.
Yup, thanks! And sorry for the delay; this merge stuff is not that
trivial, unfortunately. :-(
> Gerald, note that some of the local changes were made by Jason
> Molenda. I can tell you how to get to these. I don't know too much
> about them, except from the log entries.
I believe I've already fed all of the relevant ones back from gcc.gnu.org
to the GNATS CVS repository, and marked the others as GCC-LOCAL in the
gcc.gnu.org tree.
> 2000-01-17 Tom Tromey <address@hidden>
>
> Turn URLs in PR text into real URLs:
> * cgi-bin/gnatsweb.pl (mark_urls): New function.
> (view): Use it.
> (edit): Likewise.
>
> This patch recognizes URLs in PR text and turns them into links in the
> generated html.
This is nice. It did not apply cleanly to the current gnatsweb sources,
but the update was simple (and correct, I hope). So I installed the
following:
Thanks for the contribution. And you said that you're not a web hacker!
;-)
Gerald
Index: gnatsweb.pl
===================================================================
RCS file: /cvs/gnats/gnats/contrib/gnatsweb/gnatsweb.pl,v
retrieving revision 2.23
diff -u -3 -p -r2.23 gnatsweb.pl
--- gnatsweb.pl 2001/02/03 12:49:56 2.23
+++ gnatsweb.pl 2001/02/08 10:44:16
@@ -951,6 +951,16 @@ sub get_mailto_link
. "send email to interested parties</a>\n";
}
+# Look for text that looks like URLs and turn it into actual links.
+sub mark_urls
+{
+ my ($val) = @_;
+ # This probably doesn't catch all URLs, but one hopes it catches the
+ # majority.
+ $val =~
s/\b((s?https?|ftp):\/\/[-a-zA-Z0-9_.]+(:[0-9]+)?[-a-zA-Z0-9_\$.+\!*\(\),;:address@hidden&=?~\#\/]*)/\<a
href="$1">$1\<\/a\>/g;
+ return $val;
+}
+
sub view
{
my($viewaudit, $tmp) = @_;
@@ -1006,6 +1016,7 @@ sub view
$valign = 'valign=top';
$val =~ s/$/<br>/gm;
$val =~ s/<br>$//; # previous substitution added one too many <br>'s
+ $val = mark_urls($val);
}
print "<tr><td nowrap $valign><b>$_:</b><td>",
$q->tt($val), "\n";
@@ -1030,7 +1041,7 @@ sub view
if($viewaudit)
{
print "<h3>Audit Trail:</h3>\n",
- $q->pre($q->escapeHTML($fields{$AUDIT_TRAIL_FIELD}));
+ mark_urls($q->pre($q->escapeHTML($fields{$AUDIT_TRAIL_FIELD})));
}
page_end_html($page);
@@ -1161,7 +1172,7 @@ sub edit
page_footer($page);
print "<h3>Audit-Trail:</h3>\n",
- $q->pre($q->escapeHTML($fields{$AUDIT_TRAIL_FIELD}));
+ mark_urls($q->pre($q->escapeHTML($fields{$AUDIT_TRAIL_FIELD})));
page_end_html($page);
}
- Re: gnatsweb patches,
Gerald Pfeifer <=