X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=back2html.pm;h=ba224c79acbba03e092a68019ff015133479f37d;hb=6475b251453adf0e25cfb40ded0eb8ad216edaae;hp=d61922fd67067389eb85550682c19cdd0dd88be0;hpb=71e603fa16799249349febdb169360921dec36a6;p=webpac diff --git a/back2html.pm b/back2html.pm index d61922f..ba224c7 100644 --- a/back2html.pm +++ b/back2html.pm @@ -6,6 +6,7 @@ sub back2html { my $html = shift; + my $url_params = shift; $html =~ s/</g; $html =~ s/>/>/g; @@ -16,16 +17,32 @@ sub back2html { # 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) { + sub mkurl($) { + my $url = shift || die "mkurl needs url as argument"; # 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; + my $txturl = substr($1,0,60); + $txturl .= "..." if (length($1) > 60); + return "$txturl"; } + $items[1] =~ s#(http://[\S]+)#mkurl($1)#gie; $out .= join("