--- trunk/back2html.pm 2003/02/23 07:11:18 31
+++ trunk/back2html.pm 2003/07/06 13:03:35 79
@@ -8,9 +8,18 @@
my $html = shift;
my $out;
- foreach $line (split(/###/,$html)) {
- $out .= "
";
- my @items = split(/#-#/,$line);
+ foreach $line (split(/\s*###\s*/,$html)) {
+ $out .= " |
";
+ my @items = split(/\s*#-#\s*/,$line);
+ # convert spaces in left field to non-breaking spaces
+ $items[0] =~ s#\s+# #g;
+ # try to make link on right field
+ if ($items[1] =~ m#(http://[\S]+)\s*.*?#i) {
+ # chop URLS longer than 60 characters
+ my $url = substr($1,0,60);
+ $url .= "..." if (length($1) > 60);
+ $items[1] =~ s#(.*)\b(http://[\S]+)(\b?.*)#$1$url$3#g;
+ }
$out .= join(" | ",@items);
$out .= " |
\n";
}