--- filter.pl 2003/12/14 19:11:30 1.1.1.1 +++ filter.pl 2005/02/01 14:34:55 1.6 @@ -9,9 +9,9 @@ $pre |= ''; $post |= ''; my $isbn; - if ($href =~ m/xmlid=([^&]+)&/) { + if ($href =~ m/xmlid=([^&]+)&/i) { $isbn = $1; - } elsif ($href =~ m/xmlid=([^&]+)$/) { + } elsif ($href =~ m/xmlid=([^&]+)$/i) { $isbn = $1; } else { print STDERR "skipping $href\n"; @@ -29,7 +29,7 @@ $mode .= "_"; my $view; - if ($href =~ m/view=([^&]+)&/) { + if ($isbn =~ m/_index$/ && $href =~ m/view=([^&]+)&/) { $isbn .= "_".$1; } @@ -39,7 +39,7 @@ $isbn .= ".html"; # anchor - if ($href =~ m/(#.+)$/) { + if ($href =~ m/(#[^&]+)/) { $isbn .= $1; } @@ -58,23 +58,32 @@ } close(IN); -$html =~ s,(
URL.*$,,s || die "$infile: footer"; +$html =~ s!
URL.*$!!si || die "$infile: footer"; -$html =~ s,,,gs; +$html =~ s;;;gs; $html =~ s!(]*href=")([^"]+)("[^>]*>)!xmlid2file("$2","$1","$3")!iegs || die "$infile: links"; $html =~ s!]*href="http://[^>]+>(.+?)!$1!gs; +$html =~ s!]+Buy Print Version[^>]+>!!gs; +$html =~ s!]+onclick="OpenWin[^>]+mode=downloadPDF[^>]+>\s*]+Download this chapter[^>]+>\s*!!gs; + open(OUT,"> $outfile") || die "$outfile: $!"; print "$outfile\n"; print OUT $html; close(OUT); + + +# fix timestamp +# atime = 8, ctime = 9 +my @s = stat($infile) || die "stat $infile: $!"; +utime $s[8],$s[9], $outfile || die "touch $outfile: $1";