lib/isodoc/iso/metadata.rb in metanorma-iso-2.8.7 vs lib/isodoc/iso/metadata.rb in metanorma-iso-2.8.8

- old
+ new

@@ -65,10 +65,11 @@ # we don't leave this to i18n.rb, because we have both English and # French titles in the same document PART_LABEL = { en: "Part", fr: "Partie", ru: "Часть" }.freeze AMD_LABEL = { en: "AMENDMENT", fr: "AMENDMENT", ru: "ПОПРАВКА" }.freeze + ADD_LABEL = { en: "ADDENDUM", fr: "ADDITIF", ru: "ДОПОЛНЕНИЕ" }.freeze CORR_LABEL = { en: "TECHNICAL CORRIGENDUM", fr: "RECTIFICATIF TECHNIQUE", ru: "ТЕХНИЧЕСКОЕ ИСПРАВЛЕНИЕ" }.freeze def part_title(part, titlenums, lang) @@ -91,10 +92,14 @@ def amd_prefix(titlenums, lang) "#{self.class::AMD_LABEL[lang.to_sym]} #{titlenums[:amd]}" end + def add_prefix(titlenums, lang) + "#{self.class::ADD_LABEL[lang.to_sym]} #{titlenums[:add]}" + end + def corr_prefix(titlenums, lang) "#{self.class::CORR_LABEL[lang.to_sym]} #{titlenums[:corr]}" end def compose_title(tparts, tnums, lang) @@ -113,10 +118,11 @@ def title_nums(isoxml) prefix = "//bibdata/ext/structuredidentifier/project-number" { part: isoxml.at(ns("#{prefix}/@part")), subpart: isoxml.at(ns("#{prefix}/@subpart")), amd: isoxml.at(ns("#{prefix}/@amendment")), + add: isoxml.at(ns("#{prefix}/@addendum")), corr: isoxml.at(ns("#{prefix}/@corrigendum")) } end def title_parts(isoxml, lang) { intro: isoxml.at(ns("//bibdata/title[@type='title-intro' and " \ @@ -124,10 +130,12 @@ main: isoxml.at(ns("//bibdata/title[@type='title-main' and " \ "@language='#{lang}']")), part: isoxml.at(ns("//bibdata/title[@type='title-part' and " \ "@language='#{lang}']")), amd: isoxml.at(ns("//bibdata/title[@type='title-amd' and " \ + "@language='#{lang}']")), + add: isoxml.at(ns("//bibdata/title[@type='title-add' and " \ "@language='#{lang}']")) } end def title(isoxml, _out) lang = case @lang @@ -144,10 +152,12 @@ set(:doctitlepartlabel, part_prefix(tn, lang)) set(:doctitlepart, tp[:part].children.to_xml) if tp[:part] set(:doctitleamdlabel, amd_prefix(tn, lang)) if tn[:amd] set(:doctitleamd, tp[:amd].children.to_xml) if tp[:amd] set(:doctitlecorrlabel, corr_prefix(tn, lang)) if tn[:corr] + set(:doctitleaddlabel, add_prefix(tn, lang)) if tn[:add] + set(:doctitleadd, tp[:add].children.to_xml) if tp[:add] end def subtitle(isoxml, _out) lang = @lang == "en" ? "fr" : "en" tp = title_parts(isoxml, lang) @@ -159,9 +169,11 @@ tp[:intro] and set(:docsubtitleintro, tp[:intro].children.to_xml) set(:docsubtitlepartlabel, part_prefix(tn, lang)) tp[:part] and set(:docsubtitlepart, tp[:part].children.to_xml) set(:docsubtitleamdlabel, amd_prefix(tn, lang)) if tn[:amd] set(:docsubtitleamd, tp[:amd].children.to_xml) if tp[:amd] + set(:docsubtitleaddlabel, add_prefix(tn, lang)) if tn[:add] + set(:docsubtitleadd, tp[:add].children.to_xml) if tp[:add] set(:docsubtitlecorrlabel, corr_prefix(tn, lang)) if tn[:corr] end def author(xml, _out) super