--- isis2stream.pl 2002/06/24 13:46:53 1.10 +++ isis2stream.pl 2002/06/24 15:36:52 1.11 @@ -8,7 +8,7 @@ my %opts; -getopt('dm', \%opts); +getopts('d:m:q', \%opts); die "usage: $0 -d [database_dir] -m [database1,database2] " if (! %opts); @@ -84,6 +84,12 @@ return $tmp; } +sub c_iso_852 { + my $tmp = $_[0]; + $tmp =~ tr/ܫꔼȺ̪㍐슂ٝ// if ($tmp); + return $tmp; +} + sub c_852_czs { my $tmp = $_[0]; $tmp =~ tr//ܫꔼȺ̪㍐슂ٝ/; @@ -324,7 +330,7 @@ my $pcnt = int($row->{mfn} * 100 / $max_rowid); if ($pcnt != $last_pcnt) { - printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt); + printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt) if (! $opts{q}); $last_pcnt = $pcnt; } @@ -334,6 +340,11 @@ $headline .= isis_sf($row,'200','f'," / "); $headline .= isis_sf($row,'210','d'," , "); + # remove newlines, compress spaces + $headline =~ s/[\n\r]//g; + $headline =~ s/^\s+//g; + $headline =~ s/\s+$//g; + # author $bib .= isis_to_bib($row,'700','%700+','*',2,'<'); $bib .= isis_to_bib($row,'701','%700+','*',2,'<'); @@ -426,6 +437,7 @@ if (my $year = isis_sf($row,'210','d')) { $year =~ s/^\s*cop\.*\s*//i; $year =~ s/[\[\]]*//g; + $year =~ s/[\n\r]//g; # remove cr $mps .= "D ${year}\n" if ($year !~ m/\?/ && $year =~ /\d{4}/); } @@ -479,6 +491,7 @@ my $mps=''; while (my $isn=$row->{$isis_id}->[$i]) { $isn =~ s/ +//g; # remove spaces + $isn =~ s/[\n\r]//g; # remove cr $mps .= "W $isn $nr\n"; if ($isn =~ s/-//g) { $mps .= "W $isn $nr\n";