/[webpac]/trunk2/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

Annotation of /trunk2/back2html.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 79 - (hide annotations)
Sun Jul 6 13:03:35 2003 UTC (20 years, 8 months ago) by dpavlin
Original Path: trunk/back2html.pm
File size: 753 byte(s)
remove extra spaces

1 dpavlin 13 #
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 dpavlin 79 foreach $line (split(/\s*###\s*/,$html)) {
12     $out .= "<tr><td valign=\"top\">";
13     my @items = split(/\s*#-#\s*/,$line);
14     # convert spaces in left field to non-breaking spaces
15     $items[0] =~ s#\s+#&nbsp;#g;
16     # try to make link on right field
17 dpavlin 66 if ($items[1] =~ m#(http://[\S]+)\s*.*?#i) {
18     # chop URLS longer than 60 characters
19     my $url = substr($1,0,60);
20     $url .= "..." if (length($1) > 60);
21     $items[1] =~ s#(.*)\b(http://[\S]+)(\b?.*)#$1<a href=\"$2\">$url</a>$3#g;
22     }
23 dpavlin 13 $out .= join("</td><td>",@items);
24     $out .= "</td></tr>\n";
25     }
26 dpavlin 31 $out =~ s/&lt;br\/*&gt;/<br\/>/g;
27 dpavlin 13 return $out;
28     }
29    
30     1;

Properties

Name Value
cvs2svn:cvs-rev 1.8

  ViewVC Help
Powered by ViewVC 1.1.26