pubid-iso 1.15.6 → 1.15.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca7db4a055506011106d0c2f2e8c54dd41f8c90751de4adcf0ea7aa4c33a479f
4
- data.tar.gz: 4676fa7fb0d89f1289eb3fcc7a27bf167f8849867c72102e8113a69824fa2242
3
+ metadata.gz: 1893bea151d26da77c42fde6779f38a9bb07f4807115c567a52811ac4e9bb41a
4
+ data.tar.gz: 68d31036867e076d3f597c22774e95b62662ea01709c3944b22a78d3ed2e3cb5
5
5
  SHA512:
6
- metadata.gz: 62db235eb6454044faf6f3feac5958b321bac80d1aba37a0edc6ef5899c3b41bd890e185ee1e47a5277a2c966f1a2762b6b1c40c18354562d123db6fb5fac509
7
- data.tar.gz: 95eb033303f137db6935f668cd905cec8184779045b431e386e4547a074a7aaaaeaddb4eb2f83f3a4031efc1def94ccaa8833cfb2683346befdc4ae22843e51e
6
+ metadata.gz: 96ec944e72e01a6b9e53a429ad12fb89250801a6f49570da9d3b68facb03c51ebce36b9088eb6de9b86d4498c3ca14cff4c8819bbcd5c3ce2decf1393b0f090d
7
+ data.tar.gz: b6553af3511c3de43919bc6b871dd8996200f0620c2e9fb96e73f379d72227ec6d5cb2c8cbb12e165c92e5c4fbb281df1bd9620cf8e6b9b4256cb6c8c6b2d7ed
@@ -143,7 +143,8 @@ module Pubid::Iso
143
143
  month: supplement[:month],
144
144
  stage: supplement[:typed_stage], edition: supplement[:edition],
145
145
  iteration: supplement[:iteration], type: supplement[:type] || !supplement[:typed_stage] && :sup,
146
- publisher: supplement[:publisher]&.to_s, base: Identifier.create(**base_params)
146
+ publisher: supplement[:publisher]&.to_s, base: Identifier.create(**base_params),
147
+ separator: ([" + ", ", "].include?(supplement[:separator]&.to_s) ? supplement[:separator].to_s : nil)
147
148
  )
148
149
  end
149
150
  end
@@ -19,7 +19,10 @@ module Pubid::Iso
19
19
  },
20
20
  }.freeze
21
21
 
22
- def initialize(publisher: nil, **opts)
22
+ attr_accessor :separator
23
+
24
+ def initialize(publisher: nil, separator: nil, **opts)
25
+ @separator = separator
23
26
  super(publisher: publisher, **opts)
24
27
  end
25
28
 
@@ -119,7 +119,7 @@ module Pubid::Iso
119
119
  end
120
120
 
121
121
  rule(:supplement) do
122
- ((str("/") | space).maybe >>
122
+ ((str(" + ") | str(", ") | str("/") | space).as(:separator).maybe >>
123
123
  (((stage.as(:typed_stage) >> space).maybe >> supplements.as(:type)) |
124
124
  staged_supplement.as(:typed_stage)) >>
125
125
  (space | str(".")).repeat(1).maybe >>
@@ -14,7 +14,7 @@ module Pubid::Iso::Renderer
14
14
  base_type: @params[:base].type[:key],
15
15
  **args
16
16
  ) +
17
- if @params[:base].language
17
+ if !@params[:language] && @params[:base].language
18
18
  render_language(@params[:base].language,
19
19
  { with_language_code: with_language_code }, nil).to_s
20
20
  else
@@ -28,18 +28,26 @@ module Pubid::Iso::Renderer
28
28
  stage = params[:stage]
29
29
 
30
30
  if params[:stage].instance_of?(Pubid::Core::Stage) && !params[:stage].to_s(with_prf: opts[:with_prf]).empty?
31
- type_prefix = " #{type_prefix}"
32
- stage = params[:stage].to_s(with_prf: opts[:with_prf])
31
+ stage_str = params[:stage].to_s(with_prf: opts[:with_prf])
32
+ if stage_str == "IS"
33
+ stage = ""
34
+ else
35
+ type_prefix = " #{type_prefix}"
36
+ stage = stage_str
37
+ end
33
38
  end
34
39
 
40
+ sep = params[:separator]
41
+ sep = "/" if sep.nil? || sep.empty?
42
+
35
43
  if instance_of?(Supplement)
36
44
  if opts[:base_type] == :dir
37
45
  "%<stage>s%<publisher>s SUP%<number>s%<part>s%<iteration>s%<year>s%<month>s%<edition>s" % params
38
46
  else
39
- "/#{stage}#{type_prefix}%<number>s%<part>s%<iteration>s%<year>s%<edition>s" % params
47
+ "#{sep}#{stage}#{type_prefix}%<number>s%<part>s%<iteration>s%<year>s%<edition>s" % params
40
48
  end
41
49
  else
42
- "/#{stage}#{type_prefix}%<number>s%<part>s%<iteration>s%<year>s%<edition>s" % params
50
+ "#{sep}#{stage}#{type_prefix}%<number>s%<part>s%<iteration>s%<year>s%<edition>s" % params
43
51
  end
44
52
  end
45
53
 
@@ -10,8 +10,14 @@ module Pubid::Iso
10
10
  context[:root]
11
11
  end
12
12
 
13
- rule(edition: "Ed") do
14
- { edition: "1" }
13
+ rule(edition: subtree(:edition)) do |context|
14
+ if context[:edition].to_s == "Ed"
15
+ { edition: "1" }
16
+ elsif context[:edition].is_a?(Hash)
17
+ { edition: context[:edition].transform_values(&:to_s) }
18
+ else
19
+ context
20
+ end
15
21
  end
16
22
 
17
23
  rule(stage: subtree(:stage)) do |context|
@@ -26,15 +32,20 @@ module Pubid::Iso
26
32
  context[:supplements] =
27
33
  context[:supplements].map do |supplement|
28
34
  if supplement[:typed_stage]
29
- supplement.merge(
30
- case supplement[:typed_stage]
31
- when "PDAM" then { typed_stage: "CD", type: "Amd" }
32
- when "pDCOR" then { typed_stage: "CD", type: "Cor" }
33
- # when "DAD" then { typed_stage: "WD", type: "Amd" }
34
- when "draft" then convert_urn_sup_draft_type supplement[:type]
35
- else convert_urn_sup_stage_code(supplement)
36
- end,
37
- )
35
+ if supplement[:typed_stage] == "published"
36
+ supplement[:typed_stage] = "IS"
37
+ supplement.merge(convert_urn_sup_stage_code(supplement))
38
+ else
39
+ supplement.merge(
40
+ case supplement[:typed_stage]
41
+ when "PDAM" then { typed_stage: "CD", type: "Amd" }
42
+ when "pDCOR" then { typed_stage: "CD", type: "Cor" }
43
+ # when "DAD" then { typed_stage: "WD", type: "Amd" }
44
+ when "draft" then convert_urn_sup_draft_type supplement[:type]
45
+ else convert_urn_sup_stage_code(supplement)
46
+ end,
47
+ )
48
+ end
38
49
  else
39
50
  case supplement[:type]
40
51
  when "Addendum" then supplement.merge({ type: "Add" })
@@ -141,8 +152,12 @@ module Pubid::Iso
141
152
 
142
153
  def self.convert_urn_sup_stage_code(sup)
143
154
  stage_type = convert_urn_sup_type(sup[:type])
144
- abbr = convert_stage_code(sup[:typed_stage])
145
- stage_type[:typed_stage] = abbr if abbr
155
+ if /\A[\d.]+\z/.match?(sup[:typed_stage].to_s)
156
+ stage_type[:typed_stage] = sup[:typed_stage].to_s
157
+ else
158
+ abbr = convert_stage_code(sup[:typed_stage])
159
+ stage_type[:typed_stage] = abbr if abbr
160
+ end
146
161
  stage_type
147
162
  end
148
163
 
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Iso
3
- VERSION = "1.15.6".freeze
3
+ VERSION = "1.15.8".freeze
4
4
  end
5
5
  end
data/update_codes.yaml CHANGED
@@ -1,2 +1,4 @@
1
1
  ISO/R 657/IV: ISO/R 657-4:1969
2
2
  ISO/IEC/IEEE 8802-22.2:2015/Amd.2:2017(E): ISO/IEC/IEEE 8802-22:2015/Amd.2:2017(E)
3
+ ISO/TR 17716.2: ISO/TR 17716
4
+ ISO/TR 17716.2(E): ISO/TR 17716(E)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.6
4
+ version: 1.15.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-08 00:00:00.000000000 Z
11
+ date: 2026-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.15.6
33
+ version: 1.15.8
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.15.6
40
+ version: 1.15.8
41
41
  description: Library to generate, parse and manipulate ISO PubID.
42
42
  email:
43
43
  - open.source@ribose.com