Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse "PreCD" stage #266

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion lib/pubid/iso/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/pubid/iso/transformer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions spec/pubid_iso/identifier/create_new_identifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions spec/pubid_iso/identifier_parsing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 10 additions & 3 deletions stages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down
Loading