pubid 2.0.15 → 2.0.17

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: 5209add0745268e35159dbcf7b2066e0bc6318674df1619373543e8dcf7b630e
4
- data.tar.gz: c473a14a4045acfb75200e4d0d458264c012753a7b17c631e6852dde8d008897
3
+ metadata.gz: 0da3c4f8d7e991cfcee13325c148d4a58d3f9819521e24e96d6c9847dd0c49f1
4
+ data.tar.gz: 54c6aa151ee3c7ea3769b8ce83f153767ee48b804e967a02b805c097e71f8b31
5
5
  SHA512:
6
- metadata.gz: 4a70c4fd7d7bde415662b3f164d00600885ab5743f2bd2719c11a0a5af26d55df8c3fce41198fdbdde2a9cd245dea9a37dd11b5dc83b4b3f45e4121ab0d77a86
7
- data.tar.gz: cbd917e95992105f5439c89c100fa522cdd660f06c3f446188eb94cf5d03b6512836cb141bed0e11ab634b171e3069427cb72be6f0b6c0f17d374350ca225401
6
+ metadata.gz: 80f63afedfd49021008da385957f9ea5c4dfb858e941467be476fb41027888a802c16c1c6542c86a0ef427cc507b9a419912bcb8529f3a2fe24dfd1939e0362a
7
+ data.tar.gz: a47f5d38518d79b0443f1cb9903f5b82d6875031be8f6b579f4b6b5fb0da7dab2e68f25c3ec4ecc008554a45dcacebc17c89d69edc606dcf34ec866c3c774bd3
@@ -56,6 +56,14 @@ module Pubid
56
56
  def to_s(**opts)
57
57
  return super if opts[:format] && opts[:format] != :human
58
58
 
59
+ # A supplement segment without a stage is malformed per ISO DIR
60
+ # composition (pubid#680): raise instead of emitting a bare "/".
61
+ unless typed_stage
62
+ raise ArgumentError,
63
+ "cannot render supplement without a typed_stage: " \
64
+ "#{base.respond_to?(:to_s) ? base : self}"
65
+ end
66
+
59
67
  context = build_rendering_context(
60
68
  nil, format: :human, **opts.except(:with_publisher)
61
69
  )
@@ -13,14 +13,13 @@ module Pubid
13
13
  annotated: context.annotated,
14
14
  )
15
15
 
16
- # A nil typed_stage means "no stage" (metanorma-iso's draft-biblio
17
- # flow assigns nil through the public setter); render the supplement
18
- # without the stage segment instead of crashing on nil.render.
16
+ # A supplement without a stage renders without the stage segment.
17
+ # Flavors that require a stage raise in their own identifier class.
19
18
  stage_str = @id.typed_stage &&
20
19
  annotate(@id.typed_stage.render(context:),
21
20
  typed_stage_css(@id.typed_stage),
22
21
  annotated: context.annotated)
23
- parts << (stage_str ? "#{base_str}/#{stage_str}" : "#{base_str}/")
22
+ parts << (stage_str ? "#{base_str}/#{stage_str}" : "#{base_str}")
24
23
 
25
24
  num_port = render_number_portion(context)
26
25
  if num_port && !num_port.empty? && !num_port.start_with?(":")
data/lib/pubid/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pubid
4
- VERSION = "2.0.15"
4
+ VERSION = "2.0.17"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.15
4
+ version: 2.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.