@@ -, +, @@ tools. --------- -- whitespace failures -- no whitespace failures. --- C4/Record.pm | 42 +++++++++---------- C4/Ris.pm | 104 ++++++++++++++++++++++++------------------------ t/db_dependent/Record.t | 10 ++--- 3 files changed, 78 insertions(+), 78 deletions(-) --- a/C4/Record.pm +++ a/C4/Record.pm @@ -326,27 +326,27 @@ sub marc2endnote { if ($f500) { $abstract = $f500->subfield('a'); } - my $fields = { - DB => C4::Context->preference("LibraryName"), - Title => $marc_rec_obj->title(), - Author => $marc_rec_obj->author(), - Publisher => $f710a, - City => $f260a, - Year => $marc_rec_obj->publication_date, - Abstract => $abstract, - }; - my $endnote; - my $style = new Biblio::EndnoteStyle(); - my $template; - $template.= "DB - DB\n" if C4::Context->preference("LibraryName"); - $template.="T1 - Title\n" if $marc_rec_obj->title(); - $template.="A1 - Author\n" if $marc_rec_obj->author(); - $template.="PB - Publisher\n" if $f710a; - $template.="CY - City\n" if $f260a; - $template.="Y1 - Year\n" if $marc_rec_obj->publication_date; - $template.="AB - Abstract\n" if $abstract; - my ($text, $errmsg) = $style->format($template, $fields); - return ($text); + my $fields = { + DB => C4::Context->preference("LibraryName"), + Title => $marc_rec_obj->title(), + Author => $marc_rec_obj->author(), + Publisher => $f710a, + City => $f260a, + Year => $marc_rec_obj->publication_date, + Abstract => $abstract, + }; + my $endnote; + my $style = new Biblio::EndnoteStyle(); + my $template; + $template.= "DB - DB\n" if C4::Context->preference("LibraryName"); + $template.="T1 - Title\n" if $marc_rec_obj->title(); + $template.="A1 - Author\n" if $marc_rec_obj->author(); + $template.="PB - Publisher\n" if $f710a; + $template.="CY - City\n" if $f260a; + $template.="Y1 - Year\n" if $marc_rec_obj->publication_date; + $template.="AB - Abstract\n" if $abstract; + my ($text, $errmsg) = $style->format($template, $fields); + return ($text); } --- a/C4/Ris.pm +++ a/C4/Ris.pm @@ -817,36 +817,36 @@ sub get_keywords { ## loop over all 6XX fields foreach my $kwfield (@keywords) { - if ($kwfield != undef) { - ## authornames get special treatment - if ($fieldname eq "600") { - my $val = normalize_author($kwfield->subfield('a'), $kwfield->subfield('b'), $kwfield->subfield('c'), $kwfield->indicator('1')); - push @kw, $val; - print "Field $kwfield subfield a:", $kwfield->subfield('a'), "\r\nField $kwfield subfield b:", $kwfield->subfield('b'), "\r\nField $kwfield subfield c:", $kwfield->subfield('c'), "\r\n" if $marcprint; - } - else { - ## retrieve all available subfields - my @kwsubfields = $kwfield->subfields(); - - ## loop over all available subfield tuples - foreach my $kwtuple (@kwsubfields) { - ## loop over all subfields to check - foreach my $subfield (@subfields) { - ## [0] contains subfield code - if (@$kwtuple[0] eq $subfield) { - ## [1] contains value, remove trailing separators - @$kwtuple[1] =~ s% *[,;.:/]*$%%; - if (length(@$kwtuple[1]) > 0) { - push @kw, @$kwtuple[1]; - print "Field $fieldname subfield $subfield:", @$kwtuple[1], "\r\n" if $marcprint; - } - ## we can leave the subfields loop here - last; - } - } - } - } - } + if ($kwfield != undef) { + ## authornames get special treatment + if ($fieldname eq "600") { + my $val = normalize_author($kwfield->subfield('a'), $kwfield->subfield('b'), $kwfield->subfield('c'), $kwfield->indicator('1')); + push @kw, $val; + print "Field $kwfield subfield a:", $kwfield->subfield('a'), "\r\nField $kwfield subfield b:", $kwfield->subfield('b'), "\r\nField $kwfield subfield c:", $kwfield->subfield('c'), "\r\n" if $marcprint; + } + else { + ## retrieve all available subfields + my @kwsubfields = $kwfield->subfields(); + + ## loop over all available subfield tuples + foreach my $kwtuple (@kwsubfields) { + ## loop over all subfields to check + foreach my $subfield (@subfields) { + ## [0] contains subfield code + if (@$kwtuple[0] eq $subfield) { + ## [1] contains value, remove trailing separators + @$kwtuple[1] =~ s% *[,;.:/]*$%%; + if (length(@$kwtuple[1]) > 0) { + push @kw, @$kwtuple[1]; + print "Field $fieldname subfield $subfield:", @$kwtuple[1], "\r\n" if $marcprint; + } + ## we can leave the subfields loop here + last; + } + } + } + } + } } return @kw; } @@ -940,28 +940,28 @@ sub pool_subx { ## loop over all notefields foreach my $notefield (@notefields) { - if (defined $notefield) { - ## retrieve all available subfield tuples - my @notesubfields = $notefield->subfields(); - - ## loop over all subfield tuples - foreach my $notetuple (@notesubfields) { - ## loop over all subfields to check - foreach my $subfield (@subfields) { - ## [0] contains subfield code - if (@$notetuple[0] eq $subfield) { - ## [1] contains value, remove trailing separators - print "field $fieldname subfield $subfield: ", @$notetuple[1], "\r\n" if $marcprint; - @$notetuple[1] =~ s% *[,;.:/]*$%%; - if (length(@$notetuple[1]) > 0) { - ## add to list - push @{$aref}, @$notetuple[1]; - } - last; - } - } - } - } + if (defined $notefield) { + ## retrieve all available subfield tuples + my @notesubfields = $notefield->subfields(); + + ## loop over all subfield tuples + foreach my $notetuple (@notesubfields) { + ## loop over all subfields to check + foreach my $subfield (@subfields) { + ## [0] contains subfield code + if (@$notetuple[0] eq $subfield) { + ## [1] contains value, remove trailing separators + print "field $fieldname subfield $subfield: ", @$notetuple[1], "\r\n" if $marcprint; + @$notetuple[1] =~ s% *[,;.:/]*$%%; + if (length(@$notetuple[1]) > 0) { + ## add to list + push @{$aref}, @$notetuple[1]; + } + last; + } + } + } + } } } --- a/t/db_dependent/Record.t +++ a/t/db_dependent/Record.t @@ -113,11 +113,11 @@ is ($bibtex, $test5xml, "testing bibtex"); C4::Context->set_preference( "BibtexExportAdditionalFields", "'\@': 260\$b\ntest: 260\$b" ); $bibtex = marc2bibtex( $marc, 'testID' ); my $test6xml = qq(\@Scholastic{testID, - author = {Rowling, J.K.}, - title = {Harry potter}, - publisher = {Scholastic}, - year = {2001}, - test = {Scholastic} +\tauthor = {Rowling, J.K.}, +\ttitle = {Harry potter}, +\tpublisher = {Scholastic}, +\tyear = {2001}, +\ttest = {Scholastic} } ); is( $bibtex, $test6xml, "testing bibtex" ); --