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

- old
+ new

@@ -74,10 +74,22 @@ "60": "国家标准", "90": "(Review)", "95": "(Withdrawal)", }.freeze + STATUS_CSS = { + "00": "working-draft", + "10": "working-draft", + "20": "working-draft", + "30": "committee-draft", + "40": "draft-standard", + "50": "draft-standard", + "60": "standard", + "90": "standard", + "95": "obsolete", + } + 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 stage = "Pre" + stage if draft&.text =~ /^0\./ @@ -89,10 +101,11 @@ if docstatus set(:stage, docstatus.text.to_i) abbr = stage_abbrev_cn(docstatus.text, isoxml.at(ns("//status/iteration")), isoxml.at(ns("//version/draft"))) set(:stageabbr, abbr) + set(:status, STATUS_CSS[docstatus.text.to_sym]) end end def docid1(isoxml, _out) dn = docnumber(isoxml) @@ -133,16 +146,22 @@ mandate = isoxml.at(ns("//gbmandate"))&.text || "mandatory" prefix = isoxml.at(ns("//gbprefix"))&.text || "XXX" docyear = isoxml&.at(ns("//copyright/from"))&.text issuer = isoxml&.at(ns("//bibdata/contributor[role/@type = 'issuer']/"\ "organization/name"))&.text || "GB" - @agencies = Agencies.new(@lang, @labels, issuer) - set(:docidentifier, @agencies.docidentifier(scope, prefix, mandate, docyear, get[:docnumber])) + @agencies = GbAgencies::Agencies.new(@lang, @labels, issuer) + #set(:docidentifier, @agencies.docidentifier(scope, prefix, mandate, docyear, get[:docnumber])) + set(:docidentifier, @agencies.docidentifier(nil, nil, nil, docyear, get[:docnumber])) set(:issuer, issuer) set(:standard_class, @agencies.standard_class(scope, prefix, mandate)) set(:standard_agency, @agencies.standard_agency(scope, prefix, mandate)) - set(:gbprefix, scope == "local" ? "DB" : prefix) + if scope == "local" + set(:gbprefix, "DB") + set(:gblocalcode, prefix) + else + set(:gbprefix, prefix) + end set(:gbscope, scope) end def standard_logo(gbprefix) return nil unless gbprefix @@ -177,18 +196,18 @@ def bibdate(isoxml, _out) super m = get if @lang == "zh" set(:labelled_publisheddate, m[:publisheddate] + " " + - @labels["publicationdate_lbl"]) + @labels["publicationdate_lbl"]) set(:labelled_implementeddate, m[:implementeddate] + " " + - @labels["implementationdate_lbl"]) + @labels["implementationdate_lbl"]) else set(:labelled_publisheddate, @labels["publicationdate_lbl"] + - ": " + m[:publisheddate]) + ": " + m[:publisheddate]) set(:labelled_implementeddate, - @labels["implementationdate_lbl"] + ": " + - m[:implementeddate]) + @labels["implementationdate_lbl"] + ": " + + m[:implementeddate]) end end end end end