lib/bolognese/datacite_utils.rb in bolognese-1.11.5 vs lib/bolognese/datacite_utils.rb in bolognese-2.0.0

- old
+ new

@@ -104,13 +104,23 @@ attributes = { 'titleType' => t["titleType"], 'xml:lang' => t["lang"] }.compact xml.title(t["title"], attributes) end end end - + def insert_publisher(xml) - xml.publisher(publisher || container && container["title"]) + if publisher.is_a?(Hash) + attributes = { + 'publisherIdentifier' => publisher["publisherIdentifier"], + 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"], + 'schemeURI' => publisher["schemeUri"], + "xml:lang" => publisher["lang"] + }.compact + xml.publisher(publisher["name"] || container && container["title"], attributes) + else + xml.publisher(publisher || container && container["title"]) + end end def insert_publication_year(xml) xml.publicationYear(publication_year) end @@ -373,16 +383,14 @@ xml.southBoundLatitude(geo_location.dig("geoLocationBox", "southBoundLatitude")) xml.northBoundLatitude(geo_location.dig("geoLocationBox", "northBoundLatitude")) end end if geo_location["geoLocationPolygon"] - geo_location["geoLocationPolygon"].each do |geo_location_polygon| - xml.geoLocationPolygon do - geo_location_polygon.each do |polygon_point| - xml.polygonPoint do - xml.pointLatitude(polygon_point.dig("polygonPoint", "pointLatitude")) - xml.pointLongitude(polygon_point.dig("polygonPoint", "pointLongitude")) - end + xml.geoLocationPolygon do + Array.wrap(geo_location["geoLocationPolygon"]).each do |polygon_point| + xml.polygonPoint do + xml.pointLatitude(polygon_point.dig("polygonPoint", "pointLatitude")) + xml.pointLongitude(polygon_point.dig("polygonPoint", "pointLongitude")) end end end end end