lib/isodoc/iso/metadata.rb in metanorma-iso-1.3.25 vs lib/isodoc/iso/metadata.rb in metanorma-iso-1.3.26
- old
+ new
@@ -4,27 +4,29 @@
module Iso
class Metadata < IsoDoc::Metadata
def initialize(lang, script, labels)
super
@metadata = {
- tc: "XXXX",
- sc: "XXXX",
- wg: "XXXX",
- editorialgroup: [],
- secretariat: "XXXX",
- obsoletes: nil,
- obsoletes_part: nil
- }
+ tc: "XXXX",
+ sc: "XXXX",
+ wg: "XXXX",
+ editorialgroup: [],
+ secretariat: "XXXX",
+ obsoletes: nil,
+ obsoletes_part: nil
+ }
end
def status_abbrev(stage, substage, iter, draft, doctype)
return "" unless stage
if %w(technical-report technical-specification).include?(doctype)
stage = "DTS" if stage == "DIS"
stage = "FDTS" if stage == "FDIS"
end
- stage += iter if iter
+ if %w(PWI NWIP WD CD).include?(stage)
+ stage += iter if iter
+ end
stage = "Pre" + stage if draft =~ /^0\./
stage
end
def docstatus(isoxml, _out)
@@ -114,19 +116,27 @@
main = "#{main} — #{suffix}"
end
main
end
+ def title_nums(isoxml)
+ [isoxml.at(ns("//bibdata//project-number/@part")),
+ isoxml.at(ns("//bibdata//project-number/@subpart")),
+ isoxml.at(ns("//bibdata//project-number/@amendment")),
+ isoxml.at(ns("//bibdata//project-number/@corrigendum"))]
+ end
+
+ def title_parts(isoxml, lang)
+ [isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='#{lang}']")),
+ isoxml.at(ns("//bibdata//title[@type='title-main' and @language='#{lang}']")),
+ isoxml.at(ns("//bibdata//title[@type='title-part' and @language='#{lang}']")),
+ isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='#{lang}']"))]
+ end
+
def title(isoxml, _out)
- intro = isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='en']"))
- main = isoxml.at(ns("//bibdata//title[@type='title-main' and @language='en']"))
- part = isoxml.at(ns("//bibdata//title[@type='title-part' and @language='en']"))
- partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
- subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
- amdnumber = isoxml.at(ns("//bibdata//project-number/@amendment"))
- corrnumber = isoxml.at(ns("//bibdata//project-number/@corrigendum"))
- amd = isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='en']"))
+ intro, main, part, amd = title_parts(isoxml, "en")
+ partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
set(:doctitlemain, @c.encode(main ? main.text : "", :hexadecimal))
main = compose_title(main, intro, part, partnumber, subpartnumber, "en")
set(:doctitle, main)
set(:doctitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
@@ -136,18 +146,12 @@
set(:doctitleamd, @c.encode(amd.text, :hexadecimal)) if amd
set(:doctitlecorrlabel, corr_prefix(corrnumber, "en")) if corrnumber
end
def subtitle(isoxml, _out)
- intro = isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='fr']"))
- main = isoxml.at(ns("//bibdata//title[@type='title-main' and @language='fr']"))
- part = isoxml.at(ns("//bibdata//title[@type='title-part' and @language='fr']"))
- partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
- subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
- amdnumber = isoxml.at(ns("//bibdata//project-number/@amendment"))
- corrnumber = isoxml.at(ns("//bibdata//project-number/@corrigendum"))
- amd = isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='fr']"))
+ intro, main, part, amd = title_parts(isoxml, "fr")
+ partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
set(:docsubtitlemain, @c.encode(main ? main.text : "", :hexadecimal))
main = compose_title(main, intro, part, partnumber, subpartnumber, "fr")
set(:docsubtitle, main)
set(:docsubtitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
@@ -204,10 +208,10 @@
def doctype(isoxml, _out)
super
ics = []
isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
- set(:ics, ics.empty? ? "XXX" : ics.join(", "))
+ set(:ics, ics.empty? ? nil : ics.join(", "))
end
end
end
end