diff --git a/lib/pubid/iso.rb b/lib/pubid/iso.rb index 768144f..84398a5 100644 --- a/lib/pubid/iso.rb +++ b/lib/pubid/iso.rb @@ -17,6 +17,7 @@ module Iso require_relative "iso/transformer" require_relative "iso/identifier/base" require_relative "iso/identifier/international_standard" +require_relative "iso/identifier/international_standardized_profile" require_relative "iso/identifier/technical_report" require_relative "iso/identifier/technical_specification" require_relative "iso/identifier/technical_committee" @@ -45,3 +46,4 @@ module Iso require_relative "iso/renderer/publicly_available_specification" require_relative "iso/renderer/guide" require_relative "iso/renderer/recommendation" +require_relative "iso/renderer/international_standardized_profile" diff --git a/lib/pubid/iso/identifier/international_standardized_profile.rb b/lib/pubid/iso/identifier/international_standardized_profile.rb new file mode 100644 index 0000000..b2d6926 --- /dev/null +++ b/lib/pubid/iso/identifier/international_standardized_profile.rb @@ -0,0 +1,28 @@ +module Pubid::Iso + module Identifier + class InternationalStandardizedProfile < Base + def_delegators 'Pubid::Iso::Identifier::InternationalStandardizedProfile', :type + + TYPED_STAGES = { + dis: { + abbr: "DISP", + name: "Draft International Standardized Profile", + harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93], + }, + fdis: { + abbr: "FDISP", + name: "Final Draft International Standardized Profile", + harmonized_stages: %w[50.00 50.20 50.60 50.92], + }, + }.freeze + + def self.type + :isp + end + + def self.get_renderer_class + Renderer::InternationalStandardizedProfile + end + end + end +end diff --git a/lib/pubid/iso/renderer/international_standardized_profile.rb b/lib/pubid/iso/renderer/international_standardized_profile.rb new file mode 100644 index 0000000..68723fb --- /dev/null +++ b/lib/pubid/iso/renderer/international_standardized_profile.rb @@ -0,0 +1,16 @@ +module Pubid::Iso::Renderer + class InternationalStandardizedProfile < Base + def omit_post_publisher_symbol?(_typed_stage, _stage, _opts) + # always need post publisher symbol, because we always have to add "TR" + false + end + + def render_identifier(params, _opts) + type_prefix = (params[:typed_stage].nil? || params[:typed_stage].empty?) ? "ISP" : "" + + type_prefix = " #{type_prefix}" if params[:stage] && !params[:stage].empty? + + "%{publisher}%{typed_stage}%{stage}#{type_prefix} %{number}%{part}%{iteration}%{year}%{amendments}%{corrigendums}%{edition}" % params + end + end +end diff --git a/spec/pubid_iso/identifier/base_spec.rb b/spec/pubid_iso/identifier/base_spec.rb index aceae20..92c7855 100644 --- a/spec/pubid_iso/identifier/base_spec.rb +++ b/spec/pubid_iso/identifier/base_spec.rb @@ -625,6 +625,12 @@ module Identifier it_behaves_like "converts pubid to pubid" end + context "ISO/IEC ISP 10611-3:2003" do + let(:pubid) { "ISO/IEC ISP 10611-3:2003" } + + it_behaves_like "converts pubid to pubid" + end + describe "#parse_from_title" do subject { described_class.parse_from_title(title) } let(:title) { "#{pubid} Geographic information — Metadata — Part 1: Fundamentals" }