--- search/filters/default.pl 2002/06/13 17:25:53 1.1.1.1 +++ search/filters/default.pl 2002/10/26 20:45:16 1.7 @@ -34,124 +34,6 @@ # Application Constants # -# Field Names -%default::FieldNames = ( - '700+', 'Autor(i)', - '200', 'Naslov', - '205', 'Izdanje', - '210', 'Izdavanje', - '215', 'Materijalni opis', - '225', 'Nakladnička cjelina', - '300+', 'Napomena', - '330', 'Sadržaj', - '423', 'Prikriveni radovi', - '464', 'Analitički radovi', - '610', 'Ključne riječi', - '675+', 'Klasifik. oznaka', - '990', 'Signatura', - '991', 'Inventarni broj', - 'ISBN', 'ISBN', - 'MFN', 'MFN', - '994a', 'Knjižnica', - - - 'A', 'Author(s)', - 'B', 'Book', - 'C', 'City', - 'D', 'Date', - 'E', 'Editor', - 'F', 'Footnote', - 'G', 'Order Info', - 'H', 'Commentary', - 'I', 'Publisher', - 'J', 'Journal', - 'K', 'Keyword', - 'L', 'Label', - 'M', 'Bell', - 'N', 'Issue', - 'O', 'Other', - 'P', 'Page', - 'Q', 'Corporate', - 'R', 'Report', - 'S', 'Series', - 'T', 'Title', - 'U', 'Annotation', - 'V', 'Volume', - 'W', 'URL', - 'X', 'Abstract', - 'Y', 'Table of Contents', - 'Z', 'Reference', - '$', 'Price', - '*', 'Copyright', - '^', 'Parts', -); - - - -# Field Display Order -@default::FieldDisplayOrder = ( - 'ISBN', - '700+', - '200', - '205', - '210', - '215', - '225', - '300+', - '330', - '423', - '464', - '610', - '675+', - '990', - '991', - 'MFN', - '994a', - - 'M', - 'L', - 'T', - 'S', - 'E', - 'Q', - 'A', - 'J', - 'B', - 'D', - 'V', - 'N', - 'P', - 'C', - 'I', - 'G', - '$', - 'K', - '*', - 'W', - 'O', - 'Y', - 'X', - 'R', - '.', - 'F', - 'H', - 'U', - 'Z', - '^' -); - -# separators -%default::Separator = ( - '700+', ', ', - '990', ' ', - '991', ', ', - '300+', '.- ', - '225', ', ', - '610', ' * ', - - -); - #-------------------------------------------------------------------------- # # Function: DocumentParser() @@ -247,6 +129,8 @@ # Loop over each line in the document list foreach $FieldTag ( @default::FieldDisplayOrder ) { +# print "-- $FieldTag = $Document{$FieldTag} --"; + # Skip empty slots if ( !(defined($Document{$FieldTag}) && ($Document{$FieldTag} ne "")) ) { next; @@ -256,52 +140,28 @@ # Print the row start $DocumentFinal .= " $default::FieldNames{$FieldTag}: "; - # Print the field data, marking up if needed - if ( $FieldTag eq "A" || $FieldTag eq "E" ) { - $CommaFlag = 0; - @Authors = split(/;/, $Document{$FieldTag}); - foreach $Author ( @Authors ) { - if ( $CommaFlag ) { - $DocumentFinal .= ", "; - } - $CommaFlag = 1; - $SearchTerm = $Author; - $SearchTerm =~ s/,//g; - @AuthorNames = split(/ /, $SearchTerm); - $SearchTerm = ""; - foreach $AuthorName ( @AuthorNames ) { - if ( ! ($AuthorName =~ /^\w+\.$/) ) { - if ( $AuthorName ne "" ) { - $AuthorName .= " "; - } - $SearchTerm .= $AuthorName; - } - } - $SearchTerm =~ s/ /+/g; - $DocumentFinal .= " $Author "; - } + sub html_enc { + my $tmp = $_[0]; + $tmp =~ s/&/&/g; + $tmp =~ s//>/g; + # fix some tags + $tmp =~ s/<br>/
/gi; + return $tmp; } - elsif ( $FieldTag eq "K" ) { - $CommaFlag = 0; - @Keywords = split(/,/, $Document{$FieldTag}); - foreach $Keyword ( @Keywords ) { - if ( $CommaFlag ) { - $DocumentFinal .= ", "; - } - $CommaFlag = 1; - $SearchTerm = $Keyword; - $SearchTerm =~ s/ /+/g; - $DocumentFinal .= " $Keyword "; + + # format URI + if ( $FieldTag eq "856" ) { + my $alt = $Document{$FieldTag}; + if (length $alt > $default::max_display_url_len ) { + $alt = substr($alt,0,$default::max_display_url_len)."..."; } - } - elsif ( $FieldTag eq "W" ) { - $DocumentFinal .= " $Document{$FieldTag} "; - } - elsif ( $FieldTag eq "Y" ) { - $DocumentFinal .= "
$Document{$FieldTag}
"; - } - else { - $DocumentFinal .= "$Document{$FieldTag}"; + my $url = $Document{$FieldTag}; + $url =~ s/"/%22/g; # save " from URLs + $DocumentFinal .= "$alt"; + + } else { + $DocumentFinal .= html_enc($Document{$FieldTag}); } $DocumentFinal .= " \n";