lib/isodoc/nist/render.rb in metanorma-nist-0.0.9 vs lib/isodoc/nist/render.rb in metanorma-nist-0.1.0

- old
+ new

@@ -170,11 +170,11 @@ t = s.at("./title") a = s.at("./abbreviation") n = s.at("./number") p = s.at("./partnumber") dn = doc.at("./docnumber") - rev = doc.at(".//revision") + rev = doc&.at(".//edition")&.text.sub(/^Revision /, "") ret = "" if t title = included(type) ? wrap(t.text, " <I>", "</I>") : wrap(t.text, " ", "") ret += title ret += " (#{a.text.sub(/^NIST /, "")})" if a @@ -182,28 +182,30 @@ if n || p ret += " #{n.text}" if n ret += ".#{p.text}" if p elsif dn && is_nist(doc) ret += " #{dn.text}" - ret += " Rev. #{rev.text}" if rev + ret += " Rev. #{rev}" if rev end ret end def self.standardidentifier(doc) ret = [] + require "byebug"; byebug doc.xpath("./docidentifier").each do |id| next if %w(nist-mr nist-long).include? id["type"] ret << standardidentifier1(id) end ret.join(". ") end def self.standardidentifier1(id) r = "" + require "byebug"; byebug r += "#{id['type']} " if id["type"] and - !%w(ISO IEC nist).include? id["type"] + !%w(ISO IEC NIST).include? id["type"] r += id.text r end def self.uri(doc) @@ -292,14 +294,12 @@ 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-retire" then "Retired Draft" - when "draft-withdrawn" then "Withdrawn 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 self.parse(doc, embedded = false) ret = ""