lib/isodoc/mpfd/metadata.rb in metanorma-mpfd-0.1.0 vs lib/isodoc/mpfd/metadata.rb in metanorma-mpfd-0.1.1

- old
+ new

@@ -25,32 +25,21 @@ set(:publisher, publisher.text) if publisher end def docid(isoxml, _out) docnumber = isoxml.at(ns("//bibdata/docidentifier")) - docstatus = isoxml.at(ns("//bibdata/status")) - dn = docnumber&.text - if docstatus - set(:status, status_print(docstatus.text)) - abbr = status_abbr(docstatus.text) - dn = "#{dn}(#{abbr})" unless abbr.empty? - end - set(:docnumber, dn) + set(:docnumber, docnumber&.text) end def doctype(isoxml, _out) b = isoxml.at(ns("//bibdata")) || return return unless b["type"] t = b["type"].split(/[- ]/). map{ |w| w.capitalize unless w == "MPF" }.join(" ") set(:doctype, t) end - def status_print(status) - status.split(/-/).map{ |w| w.capitalize }.join(" ") - end - def status_abbr(status) case status when "working-draft" then "wd" when "committee-draft" then "cd" when "draft-standard" then "d" @@ -59,41 +48,28 @@ end end def version(isoxml, _out) super - revdate = get[:revdate] set(:revdate_monthyear, monthyr(revdate)) - edition = isoxml.at(ns("//version/edition")) if edition set( :edition, edition.text.to_i.localize. to_rbnf_s("SpelloutRules", "spellout-ordinal"). split(/(\W)/).map(&:capitalize).join ) end - - puts "get get[:docstage] #{get[:docstage]}" - puts get[:docstage] - if get[:docstage] == "95" and get[:docsubstage] == "99" - set(:draftinfo, "(Repealed)") - end end def monthyr(isodate) date = DateTime.parse(isodate) date.strftime('%-d %B %Y') #=> "Sun 04 Feb 2001" rescue # invalid dates get thrown isodate - end - - def security(isoxml, _out) - security = isoxml.at(ns("//bibdata/security")) || return - set(:security, security.text) end end end end