/[swish]/trunk/spider/filter.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/spider/filter.pm

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

revision 65 by dpavlin, Wed Mar 17 12:19:14 2004 UTC revision 69 by dpavlin, Thu Mar 18 23:07:21 2004 UTC
# Line 89  sub filter { Line 89  sub filter {
89    
90          if ($contents =~ s,<title>(.*)</title>,<title>$new_title</title>,is) {          if ($contents =~ s,<title>(.*)</title>,<title>$new_title</title>,is) {
91                  print STDERR "replace title '$1' with '$new_title'\n" if ($verbose);                  print STDERR "replace title '$1' with '$new_title'\n" if ($verbose);
92          } elsif (          } elsif ($contents =~ s,(<head>),$1<title>$new_title</title>,is) {
93                          # try to insert after <head>, <html> or at top                  print STDERR "adding title '$new_title' after <head>\n" if ($verbose);
94                  $contents =~ s,(<head>),$1<title>$new_title</title>,is ||          
95                  $contents =~ s,(<html>),$1<title>$new_title</title>,is ||          } elsif ($contents =~ s,(<html>),$1<head><title>$new_title</title></head>,is) {
96                          $contents =~ s,^,<title>$new_title</title>, ) {                  print STDERR "adding title '$new_title' after <html>\n" if ($verbose);
97    
98            } elsif ($contents =~ s,^,<title>$new_title</title>,)  {
99                  print STDERR "adding new title '$new_title'\n" if ($verbose);                  print STDERR "adding new title '$new_title'\n" if ($verbose);
100            } else {
101                    print STDERR "WARNING: filter couldn't add new title '$new_title' anywhere!";
102          }          }
103    
104          return $contents;          return $contents;

Legend:
Removed from v.65  
changed lines
  Added in v.69

  ViewVC Help
Powered by ViewVC 1.1.26