/[webpac]/trunk/back2html.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/back2html.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 66 - (show annotations)
Fri Jul 4 23:28:17 2003 UTC (20 years, 8 months ago) by dpavlin
File size: 620 byte(s)
chop URLS longer than 60 characters

1 #
2 # reformat html inside xml back to html (basically, support for tables)
3 #
4 # filed #-# field ###
5 # ...
6
7 sub back2html {
8 my $html = shift;
9
10 my $out;
11 foreach $line (split(/###/,$html)) {
12 $out .= "<tr><td>";
13 my @items = split(/#-#/,$line);
14 if ($items[1] =~ m#(http://[\S]+)\s*.*?#i) {
15 my $url = $1;
16 # chop URLS longer than 60 characters
17 my $url = substr($1,0,60);
18 $url .= "..." if (length($1) > 60);
19 $items[1] =~ s#(.*)\b(http://[\S]+)(\b?.*)#$1<a href=\"$2\">$url</a>$3#g;
20 }
21 $out .= join("</td><td>",@items);
22 $out .= "</td></tr>\n";
23 }
24 $out =~ s/&lt;br\/*&gt;/<br\/>/g;
25 return $out;
26 }
27
28 1;

Properties

Name Value
cvs2svn:cvs-rev 1.6

  ViewVC Help
Powered by ViewVC 1.1.26