lib/isodoc/nist/metadata.rb in metanorma-nist-0.0.9 vs lib/isodoc/nist/metadata.rb in metanorma-nist-0.1.0
- old
+ new
@@ -8,13 +8,13 @@
super
end
def iter_abbr(stage, iter)
return "F" if iter&.downcase == "final" &&
- %w(draft-wip draft-prelim draft-public).include?(stage)
+ %w(draft-wip draft-prelim draft-public draft-approval).include?(stage)
case stage
- when "draft-wip", "draft-prelim"
+ when "draft-wip", "draft-prelim", "dradt-internal", "draft-approval"
iter || ""
when "draft-public"
iter ||= "1"
iter == "1" ? "I" : iter
else
@@ -22,14 +22,15 @@
end
end
def stage_abbr(stage, iter)
case stage
- when "draft-internal" then "Internal"
+ when "draft-internal" then "#{iter_abbr(stage, iter)}ID"
when "draft-wip" then "#{iter_abbr(stage, iter)}WD"
when "draft-prelim" then "#{iter_abbr(stage, iter)}PreD"
when "draft-public" then "#{iter_abbr(stage, iter)}PD"
+ when "draft-approval" then "#{iter_abbr(stage, iter)}AD"
else
nil
end
end
@@ -48,20 +49,20 @@
main = ixml&.at(ns("//bibdata/title[@type = 'document-class']"))&.text
set(:docclasstitle, main) if main
end
def author(ixml, _out)
- tc = ixml.at(ns("//bibdata/editorialgroup/committee"))
+ tc = ixml.at(ns("//bibdata/ext/editorialgroup/committee"))
set(:tc, tc.text.upcase) if tc
personal_authors(ixml)
subdiv = ixml.at(ns("//bibdata/contributor[role/@type = 'publisher']/"\
"organization/subdivision"))
set(:nist_subdiv, subdiv.text) if subdiv
end
def docid(ixml, _out)
- docid = ixml.at(ns("//bibdata/docidentifier[@type = 'nist']"))&.text
+ docid = ixml.at(ns("//bibdata/docidentifier[@type = 'NIST']"))&.text
docid_long = ixml.at(ns("//bibdata/docidentifier"\
"[@type = 'nist-long']"))&.text
docnumber = ixml.at(ns("//bibdata/docnumber"))&.text
set(:docidentifier, docid)
set(:docidentifier_long, docid_long)
@@ -88,27 +89,16 @@
prefix
end
def iter_code(ixml)
docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
- return nil unless docstatus == "draft-public"
- iter = ixml.at(ns("//bibdata/status/iteration"))&.text || "1"
- return "IPD" if iter == "1"
- return "FPD" if iter.downcase == "final"
- "#{iter}PD"
- end
-
- # override the above
- def iter_code(ixml)
- docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
iter = ixml.at(ns("//bibdata/status/iteration"))&.text
stage_abbr(docstatus, iter)
end
def iter_ordinal(ixml)
docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
- #return nil unless docstatus == "draft-public"
iter = ixml.at(ns("//bibdata/status/iteration"))&.text
iter ||= "1" if docstatus == "draft-public"
return if iter.nil?
return "Initial" if iter == "1" && docstatus == "draft-public"
return "Final" if iter.downcase == "final"
@@ -138,19 +128,21 @@
case status
when "draft-internal" then "Internal Draft"
when "draft-wip" then "Work-in-Progress Draft"
when "draft-prelim" then "Preliminary Draft"
when "draft-public" then "Public Draft"
+ when "draft-approval" then "Approval Draft"
when "final" then "Final"
when "final-review" then "Under Review"
when "final-withdrawn" then "Withdrawn"
end
end
def version(ixml, _out)
super
- set(:revision, ixml&.at(ns("//bibdata/revision"))&.text)
+ rev = ixml&.at(ns("//bibdata/edition"))&.text&.sub(/^Revision /, "")
+ set(:revision, rev) if rev
revdate = get[:revdate]
set(:revdate_monthyear, monthyr(revdate))
set(:revdate_MMMddyyyy, MMMddyyyy(revdate))
end
@@ -221,20 +213,20 @@
Date.parse(isodate).strftime("%B %d, %Y")
end
def keywords(ixml, _out)
keywords = []
- ixml.xpath(ns("//bibdata/keyword")).each do |kw|
+ ixml.xpath(ns("//bibdata/ext/keyword")).each do |kw|
keywords << kw.text
end
set(:keywords, keywords)
end
def commentperiod(ixml, _out)
- from = ixml.at(ns("//bibdata/commentperiod/from"))&.text
- to = ixml.at(ns("//bibdata/commentperiod/to"))&.text
- extended = ixml.at(ns("//bibdata/commentperiod/extended"))&.text
+ from = ixml.at(ns("//bibdata/ext/commentperiod/from"))&.text
+ to = ixml.at(ns("//bibdata/ext/commentperiod/to"))&.text
+ extended = ixml.at(ns("//bibdata/ext/commentperiod/extended"))&.text
set(:comment_from, from) if from
set(:comment_to, to) if to
set(:comment_extended, extended) if extended
end
@@ -270,10 +262,10 @@
d = ixml.at(ns("//bibdata/relation[@type = 'obsoletedBy']/bibitem"))
return unless d
set(:superseding_status,
status_print(d.at(ns("./status/stage"))&.text || "final"))
superseding_iteration(d)
- docid = d.at(ns("./docidentifier[@type = 'nist']"))&.text and
+ docid = d.at(ns("./docidentifier[@type = 'NIST']"))&.text and
set(:superseding_docidentifier, docid)
docid_long = d.at(ns("./docidentifier[@type = 'nist-long']"))&.text and
set(:superseding_docidentifier_long, docid_long)
superseding_dates(d)
doi = d.at(ns("./uri[@type = 'doi']"))&.text and