/[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 71 by dpavlin, Sat Apr 3 15:15:36 2004 UTC revision 74 by dpavlin, Wed Apr 7 12:54:21 2004 UTC
# Line 58  sub filter { Line 58  sub filter {
58    
59          if ($contents =~ m,<!--SafTocEntry="([^"]+)"-->,is) {          if ($contents =~ m,<!--SafTocEntry="([^"]+)"-->,is) {
60                  $new_title = $1;                  $new_title = $1;
61          } elsif ($contents =~ m,<(h\d)\sclass="docPartTitle"[^>]*>(.+?)<\1>,is) {                  print STDERR "using title '$new_title' from <!--SafTocEntry-->\n" if ($verbose);
62            } elsif ($contents =~ m,<(h\d)\s+class="docPartTitle"[^>]*>(.+?)</\1>,is) {
63                  $new_title = $2;                  $new_title = $2;
64          } elsif ($contents =~ m,<(h\d)\sclass="docChapterTitle"[^>]*>(.+?)<\1>,is) {                  print STDERR "using title '$new_title' from docPartTitle\n" if ($verbose);
65            } elsif ($contents =~ m,<(h\d)\s+class="docChapterTitle"[^>]*>(.+?)</\1>,is) {
66                  $new_title = $2;                  $new_title = $2;
67          } elsif ($contents =~ m,<(h\d)\sclass="docSection1Title"[^>]*>(.+?)<\1>,is) {                  print STDERR "using title '$new_title' from docChapterTitle\n" if ($verbose);
68            } elsif ($contents =~ m,<(h\d)\s+class="docSection1Title"[^>]*>(.+?)</\1>,is) {
69                  $new_title = $2;                  $new_title = $2;
70          } elsif ($contents =~ m,<(h\d)\sclass="chapter"[^>]*>(.+?)<\1>,is) {                  print STDERR "using title '$new_title' from docSection1Title\n" if ($verbose);
71            } elsif ($contents =~ m,<(h\d)\s+class="doc[^"]*Title"[^>]*>(.+?)</\1>,is) {
72                  $new_title = $2;                  $new_title = $2;
73          } elsif ($contents =~ m,<(h\d)\sclass="sect1"[^>]*>(.+?)<\1>,is) {                  print STDERR "using title '$new_title' from doc.+Title\n" if ($verbose);
74            } elsif ($contents =~ m,<(h\d)\s+class="chapter"[^>]*>(.+?)</\1>,is) {
75                  $new_title = $2;                  $new_title = $2;
76                    print STDERR "using title '$new_title' from chapter\n" if ($verbose);
77            } elsif ($contents =~ m,<(h\d)\s+class="sect1"[^>]*>(.+?)</\1>,is) {
78                    $new_title = $2;
79                    print STDERR "using title '$new_title' from sect1\n" if ($verbose);
80          } else {          } else {
81                  if ($contents =~ m,<title>([^<]+)</title>,is) {                  if ($contents =~ m,<title>([^<]+)</title>,is) {
82                          $new_title = $1;                          $new_title = $1;
83                            print STDERR "using title '$new_title' from <title>\n" if ($verbose);
84                  } elsif ($contents =~ m,<h\d[^>]*>([^<]+)</h\d>,is) {                  } elsif ($contents =~ m,<h\d[^>]*>([^<]+)</h\d>,is) {
85                          $new_title = $1;                          $new_title = $1;
86                            print STDERR "using title '$new_title' from <h_>\n" if ($verbose);
87                  }                  }
88          }          }
89    
# Line 87  sub filter { Line 98  sub filter {
98                  $b =~ s/([^a-zA-Z])+/ /gs;                  $b =~ s/([^a-zA-Z])+/ /gs;
99                  if ($a =~ m/$b/i) {                  if ($a =~ m/$b/i) {
100                          $new_title = $collection;                          $new_title = $collection;
101                            print STDERR "new_title and collection are same! [$new_title]\n" if ($verbose);
102                  } else {                  } else {
103                          $new_title = "$collection :: $new_title";                          $new_title = "$collection :: $new_title";
104                  }                  }

Legend:
Removed from v.71  
changed lines
  Added in v.74

  ViewVC Help
Powered by ViewVC 1.1.26