/[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

Diff of /trunk/back2html.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 151 by dpavlin, Sun Nov 16 22:39:36 2003 UTC revision 636 by dpavlin, Tue Jan 18 17:07:14 2005 UTC
# Line 6  Line 6 
6    
7  sub back2html {  sub back2html {
8          my $html = shift;          my $html = shift;
9            my $url_params = shift;
10    
11          $html =~ s/</&lt;/g;          $html =~ s/</&lt;/g;
12          $html =~ s/>/&gt;/g;          $html =~ s/>/&gt;/g;
# Line 16  sub back2html { Line 17  sub back2html {
17                  # convert spaces in left field to non-breaking spaces                  # convert spaces in left field to non-breaking spaces
18                  $items[0] =~ s#\s+#&nbsp;#g;                  $items[0] =~ s#\s+#&nbsp;#g;
19                  # try to make link on right field                  # try to make link on right field
20                  sub mkurl {                  sub mkurl($) {
21                          my $url = shift || die "mkurl needs url as argument";                          my $url = shift || die "mkurl needs url as argument";
22                          # chop URLS longer than 60 characters                          # chop URLS longer than 60 characters
23                          my $txturl = substr($1,0,60);                          my $txturl = substr($1,0,60);
# Line 30  sub back2html { Line 31  sub back2html {
31          # put <br> back into html          # put <br> back into html
32          $out =~ s,&lt;br/*&gt;,<br/>,gi;          $out =~ s,&lt;br/*&gt;,<br/>,gi;
33          # put <a href=xxx>yyyy</a> back into html          # put <a href=xxx>yyyy</a> back into html
34          $out =~ s,&lt;(a\s+href=)(.+?)&gt;(.+?)&lt;(/a)&gt;,<$1$2>$3<$4>,gsi;          sub mkurl_param($$$$) {
35                    my ($a_href,$url,$text,$a_end) = @_;
36                    if ($url =~ m#\?#) {
37                            $url .= "&".$url_params;
38                    } else {
39                            $url .= "?".$url_params;
40                    }
41                    return '<'.$a_href.'"'.$url.'">'.$text.'<'.$a_end.'>';
42            }
43            $out =~ s#&lt;(a\s+href=)['"]*(.+?)['"]*&gt;(.+?)&lt;(/a)&gt;#mkurl_param($1,$2,$3,$4)#gsie;
44          return $out;          return $out;
45  }  }
46    

Legend:
Removed from v.151  
changed lines
  Added in v.636

  ViewVC Help
Powered by ViewVC 1.1.26