lib/isodoc/gb/metadata.rb in asciidoctor-gb-0.3.3 vs lib/isodoc/gb/metadata.rb in asciidoctor-gb-0.3.4

- old
+ new

@@ -35,16 +35,14 @@ end def set_doctitle if @lang == "zh" set(:doctitle, get[:docmaintitlezh] + - get[:docsubtitlezh] + - get[:docparttitlezh]) + get[:docsubtitlezh] + get[:docparttitlezh]) else set(:doctitle, get[:docmaintitleen] + - get[:docsubtitleen] + - get[:docparttitleen]) + get[:docsubtitleen] + get[:docparttitleen]) end end def subtitle(isoxml, _out) intro = isoxml.at(ns("//title-intro[@language='en']")) @@ -62,10 +60,23 @@ def author(isoxml, _out) gbcommittee = isoxml.at(ns("//bibdata/gbcommittee")) set(:committee, gbcommittee&.text) end + # from ISO + STAGE_ABBRS = { + "00": "PWI", + "10": "NWIP", + "20": "WD", + "30": "CD", + "40": "DIS", + "50": "FDIS", + "60": "IS", + "90": "(Review)", + "95": "(Withdrawal)", + }.freeze + STAGE_ABBRS_CN = { "00": "新工作项目建议", "10": "新工作项目", "20": "标准草案工作组讨论稿", "30": "标准草案征求意见稿", @@ -85,9 +96,16 @@ "50": "draft-standard", "60": "standard", "90": "standard", "95": "obsolete", } + + def stage_abbrev(stage, iter, draft) + stage = STAGE_ABBRS[stage.to_sym] || "??" + stage += iter.text if iter + stage = "Pre" + stage if draft&.text =~ /^0\./ + stage + end def stage_abbrev_cn(stage, iter, draft) return stage_abbrev(stage, iter, draft) if @lang != "zh" stage = STAGE_ABBRS_CN[stage.to_sym] || "??" stage = "#{iter.text.to_i.localize(:zh).spellout}次#{stage}" if iter