lib/isodoc/nist/metadata.rb in metanorma-nist-0.2.3 vs lib/isodoc/nist/metadata.rb in metanorma-nist-0.2.4

- old
+ new

@@ -149,13 +149,16 @@ def bibdate(ixml, _out) super ixml.xpath(ns("//bibdata/date")).each do |d| val = Common::date_range(d) next if val == "XXX" - set("#{d['type']}date_monthyear".to_sym, daterange_proc(val, :monthyr)) - set("#{d['type']}date_mmddyyyy".to_sym, daterange_proc(val, :mmddyyyy)) - set("#{d['type']}date_MMMddyyyy".to_sym, daterange_proc(val, :MMMddyyyy)) + set("#{d['type']}date_monthyear".to_sym, + daterange_proc(val, :monthyr)) + set("#{d['type']}date_mmddyyyy".to_sym, + daterange_proc(val, :mmddyyyy)) + set("#{d['type']}date_MMMddyyyy".to_sym, + daterange_proc(val, :MMMddyyyy)) end withdrawal_pending(ixml) most_recent_date(ixml) end @@ -191,10 +194,13 @@ end def series(ixml, _out) series = ixml.at(ns("//bibdata/series[@type = 'main']/title"))&.text set(:series, series) if series + seriesabbr = + ixml.at(ns("//bibdata/series[@type = 'main']/abbreviation"))&.text + set(:seriesabbr, seriesabbr) if seriesabbr subseries = ixml.at(ns("//bibdata/series[@type = 'secondary']/"\ "title"))&.text set(:subseries, subseries) if subseries end @@ -273,22 +279,26 @@ set(:superseding_doi, doi) uri = d.at(ns("./uri[@type = 'uri']"))&.text and set(:superseding_uri, uri) superseding_titles(ixml, d) authors = d.xpath(ns("./contributor[role/@type = 'author']/person")) - authors = ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person")) if authors.empty? + authors.empty? and authors = + ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person")) set(:superseding_authors, extract_person_names(authors)) end def superseding_titles(ixml, d) title = d.at(ns("./title[@type = 'main']"))&.text if title set(:superseding_title, d.at(ns("./title[@type = 'main']"))&.text) - set(:superseding_subtitle, d.at(ns("./title[@type = 'subtitle']"))&.text) + set(:superseding_subtitle, + d.at(ns("./title[@type = 'subtitle']"))&.text) else - set(:superseding_title, ixml.at(ns("//bibdata/title[@type = 'main']"))&.text) - set(:superseding_subtitle, ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text) + set(:superseding_title, + ixml.at(ns("//bibdata/title[@type = 'main']"))&.text) + set(:superseding_subtitle, + ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text) end end def superseding_iteration(d) return unless d.at(ns("./status/stage"))&.text == "draft-public" @@ -326,10 +336,11 @@ def note(xml, _out) note = xml.at(ns("//bibdata/note[@type = 'additional-note']"))&.text and set(:additional_note, note) note = xml.at(ns("//bibdata/note[@type = 'withdrawal-note']"))&.text and set(:withdrawal_note, note) - note = xml.at(ns("//bibdata/note[@type = 'withdrawal-announcement-link']"))&.text and + note = xml.at(ns("//bibdata/note[@type = "\ + "'withdrawal-announcement-link']"))&.text and set(:withdrawal_announcement_link, note) end end end end