lib/bolognese/datacite_utils.rb in bolognese-0.15.3 vs lib/bolognese/datacite_utils.rb in bolognese-0.15.6

- old
+ new

@@ -146,10 +146,23 @@ def insert_subjects(xml) return xml unless keywords.present? xml.subjects do keywords.each do |subject| - xml.subject(subject) + if subject.is_a?(String) then + # If we've been read from somewhere that it was just a string output that + xml.subject(subject) + else + # Otherwise we'll assume a hash and therefore find/add attributes as appropriate + subject_node = xml.subject(subject['text']) + if subject["subject_scheme"].present? then + subject_node['subjectScheme'] = subject["subject_scheme"] + end + + if subject["scheme_uri"].present? then + subject_node['schemeURI'] = subject["scheme_uri"] + end + end end end end def insert_version(xml)