[open-ils-commits] r15748 - branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Utils (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 8 22:35:30 EST 2010


Author: dbs
Date: 2010-03-08 22:35:28 -0500 (Mon, 08 Mar 2010)
New Revision: 15748

Modified:
   branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm
Log:
Backport r15299 to fix spurious colons after leading articles


Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm	2010-03-09 03:19:44 UTC (rev 15747)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm	2010-03-09 03:35:28 UTC (rev 15748)
@@ -110,7 +110,7 @@
 
 sub get_field_value {
 
-	my( $self, $mods, $xpath ) = @_;
+	my( $self, $mods, $xpath, $type) = @_;
 
 	my @string;
 
@@ -126,6 +126,12 @@
 			my @children = $value->childNodes();
 			my @child_text;
 			for my $child (@children) {
+				# MODS strips the punctuation from 245abc, which often
+				# results in "title subtitle" rather than "title : subtitle";
+				# this hack gets it back for us
+				if ($type eq 'title' && $child->nodeName =~ m/subTitle/) {
+					push(@child_text, " : "); 
+				}
 				next unless( $child->nodeType != 3 );
 
 				if($child->childNodes) {
@@ -194,7 +200,7 @@
 		my $class = "title";
 		$data->{$class} = {};
 		for my $type(keys %{$xpathset->{$class}}) {
-			my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
+			my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type}, "title" );
 			for my $arr (@value) {
 				if( ref($arr) ) {
 					$data->{$class}->{$type} = shift @$arr;
@@ -207,7 +213,6 @@
 					}
 
 					for my $t (@$arr) {
-						$data->{$class}->{$type} .= ' : ' if ($data->{$class}->{$type} =~ /\w\s*$/o);
 						$data->{$class}->{$type} .= " $t";
 					}
 				} else {



More information about the open-ils-commits mailing list