diff --git a/README.adoc b/README.adoc index 6fe7e78..022c24b 100644 --- a/README.adoc +++ b/README.adoc @@ -61,6 +61,21 @@ pubid.to_s => "ISO/WD 1234" ---- +==== "PreCD" stage + +For "PreCD" stage we’re using a special stage called "29" that is not in the International Harmonized Codes. + +[source,ruby] +---- +pubid = Pubid::Iso::Identifier.create(publisher: "ISO", stage: :PreCD, number: 123) +pubid.to_s + +=> "ISO/PreCD 123" + +subject.stage.harmonized_code.stages +=> ["29.00", "29.20", "29.60", "29.92", "29.98", "29.99"] +---- + === With part number [source,ruby] diff --git a/lib/pubid/iso/parser.rb b/lib/pubid/iso/parser.rb index 1ca727b..7813a2e 100644 --- a/lib/pubid/iso/parser.rb +++ b/lib/pubid/iso/parser.rb @@ -49,7 +49,8 @@ class Parser < Pubid::Core::Parser end rule(:stage) do - array_to_str(Pubid::Iso::Renderer::Base::TRANSLATION[:russian][:stage].values) | array_to_str(STAGES) + array_to_str(Pubid::Iso::Renderer::Base::TRANSLATION[:russian][:stage].values) | array_to_str(STAGES) | + (str("preCD") | str("PreCD")) end rule(:typed_stage) do diff --git a/lib/pubid/iso/transformer.rb b/lib/pubid/iso/transformer.rb index abc86d7..7f920f4 100644 --- a/lib/pubid/iso/transformer.rb +++ b/lib/pubid/iso/transformer.rb @@ -136,6 +136,8 @@ def self.convert_stage(code) { stage: "CD", type: "TR" } when "PDTS" { stage: "CD", type: "TS" } + when "preCD" + { stage: "PreCD" } else { stage: code } end diff --git a/spec/pubid_iso/identifier/create_new_identifier_spec.rb b/spec/pubid_iso/identifier/create_new_identifier_spec.rb index 2522a0f..14426c6 100644 --- a/spec/pubid_iso/identifier/create_new_identifier_spec.rb +++ b/spec/pubid_iso/identifier/create_new_identifier_spec.rb @@ -140,6 +140,14 @@ module Pubid::Iso end end end + + context "stage is PreCD" do + let(:stage) { "PreCD" } + + it "renders separate stage for PubID" do + expect(subject.to_s).to eq("ISO/PreCD #{number}") + end + end end context "when TS type" do diff --git a/spec/pubid_iso/identifier_parsing_spec.rb b/spec/pubid_iso/identifier_parsing_spec.rb index eaebab0..4d41643 100644 --- a/spec/pubid_iso/identifier_parsing_spec.rb +++ b/spec/pubid_iso/identifier_parsing_spec.rb @@ -1032,5 +1032,19 @@ module Pubid::Iso it_behaves_like "converts pubid to pubid with prf" end + + context "ISO/IEC preCD 29135" do + let(:original) { "ISO/IEC preCD 29135" } + let(:pubid) { "ISO/IEC PreCD 29135" } + + it_behaves_like "converts pubid to pubid" + end + + context "ISO/PreCD3 17301-1" do + let(:original) { "ISO/PreCD3 17301-1" } + let(:pubid) { "ISO/PreCD 17301-1.3" } + + it_behaves_like "converts pubid to pubid" + end end end diff --git a/stages.yaml b/stages.yaml index 46350d5..f46078d 100644 --- a/stages.yaml +++ b/stages.yaml @@ -3,6 +3,7 @@ abbreviations: NP: ["10.00", "10.20", "10.60", "10.98", "10.92"] AWI: ["20.00", "10.99"] WD: ["20.20", "20.60", "20.98", "20.99"] + PreCD: ["29.00", "29.20", "29.60", "29.92", "29.98", "29.99"] CD: ["30.00", "30.20", "30.60", "30.92", "30.98", "30.99"] FCD: ["40.00", "40.20", "40.60", "40.92", "40.98", "40.99"] PRF: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"] @@ -32,6 +33,12 @@ codes_description: "20.60": Close of comment period "20.98": Project deleted "20.99": WD approved for registration as CD + "29.00": Committee draft (CD) registered + "29.20": CD study/ballot initiated + "29.60": Close of voting/ comment period + "29.92": CD referred back to Working Group + "29.98": Project deleted + "29.99": CD approved for registration as DIS "30.00": Committee draft (CD) registered "30.20": CD study/ballot initiated "30.60": Close of voting/ comment period @@ -84,9 +91,9 @@ substage_codes: proceed: "99" draft_codes: ["00.00", "00.20", "00.60", "00.99", "10.00", "10.20", "10.60", "10.92", - "10.99", "20.00", "20.20", "20.60", "20.99", "30.00", - "30.20", "30.60", "30.92", "30.99", "40.00", "40.20", "40.60", "40.92", - "40.93", "40.99", "50.00", "50.20", "50.60", "50.92", "50.99"] + "10.99", "20.00", "20.20", "20.60", "20.99", "29.00", "29.20", "29.60", "29.92", + "29.99", "30.00", "30.20", "30.60", "30.92", "30.99", "40.00", "40.20", "40.60", + "40.92", "40.93", "40.99", "50.00", "50.20", "50.60", "50.92", "50.99"] canceled_codes: ["00.98", "10.98", "20.98", "30.98", "40.98", "50.98", "95.99"] published_codes: ["60.00", "60.60", "90.20", "90.60", "90.92", "90.93", "90.99", "95.20", "95.60", "95.92"]