User: sits
Date: 08/07/11 20:10:40
Modified: lib/Codestriker/Template/Plugin AutomagicLinks.pm
Log:
Fixed the corner case where the link wasn't shown correctly if at the end of
the comment.
Index: AutomagicLinks.pm
===================================================================
RCS file:
/cvsroot/codestriker/codestriker/lib/Codestriker/Template/Plugin/AutomagicLinks.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AutomagicLinks.pm 9 Feb 2006 23:19:38 -0000 1.3
+++ AutomagicLinks.pm 12 Jul 2008 03:10:40 -0000 1.4
@@ -16,19 +16,19 @@
# First handle any URL linking.
my @words = split /(\s)/, $text;
my $result = "";
- for (my $i = 0; $i <= $#words; $i++) {
- if ($words[$i] =~ /^([A-Za-z]+:\/\/.*[A-Za-z0-9_])(.*)$/o) {
+ for my $word (@words) {
+ if ($word =~ /^([A-Za-z]+:\/\/[^<]+[^<\.])(.*)$/o) {
# A URL, create a link to it.
- $result .= "<A HREF=\"$1\">$1</A>$2";
+ $result .= "<a href=\"$1\">$1</a>$2";
} else {
- $result .= $words[$i];
+ $result .= $word;
}
}
# If there is a link to a bug tracking system, automagically modify all
# text of the form "[Bb]ug \d+" to a hyperlink for that bug record.
if (defined $Codestriker::bugtracker && $Codestriker::bugtracker ne "") {
- $result =~ s/(\b)([Bb][Uu][Gg]\s*(\d+))(\b)/$1<A
HREF="${Codestriker::bugtracker}$3">$1$2$4<\/A>/mg;
+ $result =~ s/(\b)([Bb][Uu][Gg]\s*(\d+))(\b)/$1<a
href="${Codestriker::bugtracker}$3">$1$2$4<\/a>/mg;
}
return $result;
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits