[rt-users] patch to make links
Alan Jaffray
jaffray at pobox.com
Sat Nov 25 23:10:22 EST 2000
I just started experimenting with RT 1.0.5 and StripMIME.
Here's a quick and minimally tested patch to make links out of any
appropriate http://blahblah.com/blah/blah text (in message bodies,
in stripmime commments, etc) in the web interface. Comments or
corrections welcome.
Alan
-------------- next part --------------
*** /tmp/rt-1.0.5/lib/rt/ui/web/support.pm Sat Nov 25 23:10:04 2000
--- support.pm Sat Nov 25 21:48:42 2000
***************
*** 58,63 ****
--- 58,66 ----
my ($value) = shift;
$value =~ s/</</g;
$value =~ s/>/>/g;
+ my $hostname_regexp = q{[\w\-]+(?:\.[\w\-]+)+};
+ my $url_regexp = q{http://} . $hostname_regexp . q{(?:[^\s\>]*[^\s\>\.\,\"\'])};
+ $value =~ s,($url_regexp),<a href="$1">$1</a>,g;
print "$value";
}
***************
*** 113,119 ****
}
$body =~ s/(.{76})\s+/$1\n/g;
! $body =~ s/(.{100})/$1\n/g;
print "<pre>";
&print_html($body);
--- 116,122 ----
}
$body =~ s/(.{76})\s+/$1\n/g;
! # $body =~ s/(.{100})/$1\n/g;
print "<pre>";
&print_html($body);
More information about the rt-users
mailing list