pubid 2.0.25 → 2.0.27

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +115 -167
  3. data/data/parg/cen_pfs.json +1 -1
  4. data/data/parg/etsi_pfs.json +1 -1
  5. data/lib/pubid/cen_pfs/adopted_base.rb +114 -0
  6. data/lib/pubid/cen_pfs/builder.rb +157 -21
  7. data/lib/pubid/cen_pfs/identifier.rb +106 -48
  8. data/lib/pubid/cen_pfs/identifiers/adopted_european_norm.rb +55 -0
  9. data/lib/pubid/cen_pfs/identifiers/amendment.rb +27 -0
  10. data/lib/pubid/cen_pfs/identifiers/cen_report.rb +36 -0
  11. data/lib/pubid/cen_pfs/identifiers/cen_workshop_agreement.rb +36 -0
  12. data/lib/pubid/cen_pfs/identifiers/consolidated_identifier.rb +41 -0
  13. data/lib/pubid/cen_pfs/identifiers/corrigendum.rb +27 -0
  14. data/lib/pubid/cen_pfs/identifiers/european_norm.rb +43 -23
  15. data/lib/pubid/cen_pfs/identifiers/european_prestandard.rb +55 -0
  16. data/lib/pubid/cen_pfs/identifiers/european_specification.rb +36 -0
  17. data/lib/pubid/cen_pfs/identifiers/fragment.rb +28 -0
  18. data/lib/pubid/cen_pfs/identifiers/guide.rb +36 -0
  19. data/lib/pubid/cen_pfs/identifiers/harmonization_document.rb +36 -0
  20. data/lib/pubid/cen_pfs/identifiers/supplement.rb +39 -0
  21. data/lib/pubid/cen_pfs/identifiers/technical_report.rb +36 -0
  22. data/lib/pubid/cen_pfs/identifiers/technical_specification.rb +36 -0
  23. data/lib/pubid/cen_pfs/identifiers.rb +15 -1
  24. data/lib/pubid/cen_pfs/pubid_urn_schema.rb +20 -1
  25. data/lib/pubid/cen_pfs/renderer.rb +50 -1
  26. data/lib/pubid/cen_pfs/urn_generator.rb +75 -3
  27. data/lib/pubid/cen_pfs.rb +7 -16
  28. data/lib/pubid/doi_pfs/builder.rb +2 -2
  29. data/lib/pubid/etsi_pfs/CLAUDE.md +48 -40
  30. data/lib/pubid/etsi_pfs/builder.rb +45 -12
  31. data/lib/pubid/etsi_pfs/identifier.rb +23 -41
  32. data/lib/pubid/etsi_pfs/identifiers/amendment.rb +20 -0
  33. data/lib/pubid/etsi_pfs/identifiers/corrigendum.rb +20 -0
  34. data/lib/pubid/etsi_pfs/identifiers/standard.rb +64 -15
  35. data/lib/pubid/etsi_pfs/identifiers/supplement.rb +72 -0
  36. data/lib/pubid/etsi_pfs/identifiers.rb +4 -1
  37. data/lib/pubid/etsi_pfs/pubid_urn_schema.rb +4 -2
  38. data/lib/pubid/etsi_pfs/renderer.rb +29 -1
  39. data/lib/pubid/etsi_pfs/urn_generator.rb +40 -3
  40. data/lib/pubid/etsi_pfs.rb +2 -1
  41. data/lib/pubid/version.rb +1 -1
  42. metadata +20 -2
@@ -3,7 +3,35 @@ module Pubid
3
3
  # Human renderer, generated from the canonical template.
4
4
  class Renderer < ::Pubid::Renderers::Base
5
5
  def render(**_opts)
6
- "ETSI #{@id.type} #{@id.number}"
6
+ f = render_fields(@id)
7
+ "ETSI #{f[:type]} #{f[:number]}#{(" #{f[:minor]}") if f[:minor]}#{("#{f[:parts]}") if f[:parts]}#{f[:supplements]}#{if f[:version]; " V#{f[:version]}" elsif f[:edition]; " ed.#{f[:edition]}"; end}#{(" (#{f[:year]}-#{f[:month]})") if f[:year] && f[:month]}"
8
+ end
9
+
10
+ private
11
+
12
+ # The field view: a supplement wrapper reads through to
13
+ # the wrapped standard and carries the notation run
14
+ # ("/A1/C1", outermost last); the fold's target renders
15
+ # only outside the fold flag (the V/ed faces are mutually
16
+ # exclusive by grammar).
17
+ def render_fields(id)
18
+ root = id
19
+ run = +""
20
+ while root.is_a?(Identifiers::Supplement)
21
+ run.prepend("/#{root.supplement_notation}")
22
+ root = root.base
23
+ end
24
+ {
25
+ type: root.type,
26
+ number: root.number,
27
+ minor: root.minor,
28
+ parts: root.parts.any? ? root.parts.map { |item| "-#{item}" }.join : nil,
29
+ version: root.is_edition ? nil : root.version,
30
+ edition: root.is_edition ? root.version : nil,
31
+ year: root.year,
32
+ month: root.month,
33
+ supplements: run.empty? ? nil : run,
34
+ }
7
35
  end
8
36
  end
9
37
  end
@@ -1,12 +1,49 @@
1
1
  module Pubid
2
2
  module EtsiPfs
3
- # The official URN generator, pinned to the scheme's declared
4
- # namespace ("etsi") so to_urn stays
5
- # scheme-canonical under the compiled flavor key.
3
+ # The official URN generator: the scheme's declared namespace
4
+ # ("etsi") and the ordered segments the
5
+ # definition's urn.official declares — an absent field leaves no
6
+ # segment, a date group joins its fields with "-", a compose
7
+ # slots its fields with the declared glue, and a fold target
8
+ # switches to its edition affix while the flag holds.
6
9
  class UrnGenerator < ::Pubid::UrnGenerator::Base
7
10
  def urn_namespace
8
11
  "etsi"
9
12
  end
13
+
14
+ def generate
15
+ parts = ["urn", urn_namespace]
16
+ parts.concat(official_segments)
17
+ parts.join(":")
18
+ end
19
+
20
+ private
21
+
22
+ # A supplement wrapper reads through to the wrapped
23
+ # standard (the coded generator's own delegation shape).
24
+ def subject
25
+ current = @identifier
26
+ current = current.base while current.is_a?(Identifiers::Supplement)
27
+ current
28
+ end
29
+
30
+ def official_segments
31
+ segments = []
32
+ segments << subject.type.to_s.downcase if subject.type
33
+ code = []
34
+ code << subject.number.to_s if subject.number
35
+ code << " " + subject.minor.to_s if subject.minor
36
+ subject.parts.each { |item| code << "-" + item } if subject.parts.any?
37
+ segments << code.join unless code.empty?
38
+ if subject.is_edition
39
+ segments << "ed." + subject.version.to_s.downcase
40
+ elsif subject.version
41
+ segments << "v" + subject.version.to_s.downcase
42
+ end
43
+ date = [subject.year, subject.month].compact
44
+ segments << date.join("-") unless date.empty?
45
+ segments
46
+ end
10
47
  end
11
48
  end
12
49
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  # PFS-generated flavor — DO NOT EDIT BY HAND.
4
- # Source: definitions/etsi.pfs (pfs:1) sha256:9343088bf087b55ea790057e6be0bbebe2272407ee81f035b52e5f9a4d5c7b76
4
+ # Source: definitions/etsi.pfs (pfs:1) sha256:490ba9435f44dbd2d59429ae6d9527909c39444f19fec5a33a8cad91e89e3581
5
5
  # Compiler: pubid/grammar/pfs 0.1.0 (baked with parsanol 1.3.126)
6
6
  # Regenerate: ruby scripts/pfs compile definitions/etsi.pfs --as etsi_pfs --ruby-out <dir>
7
7
 
@@ -16,6 +16,7 @@ module Pubid
16
16
  extend Pubid::PrefixesSupport
17
17
 
18
18
  PREFIXES = ["ETSI"].freeze
19
+
19
20
 
20
21
  autoload :Builder, "#{__dir__}/etsi_pfs/builder"
21
22
  autoload :Identifier, "#{__dir__}/etsi_pfs/identifier"
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.25"
4
+ VERSION = "2.0.27"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.25
4
+ version: 2.0.27
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-11-13 00:00:00.000000000 Z
11
+ date: 2026-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -404,10 +404,25 @@ files:
404
404
  - lib/pubid/cen_cenelec/urn_generator.rb
405
405
  - lib/pubid/cen_cenelec/urn_parser.rb
406
406
  - lib/pubid/cen_pfs.rb
407
+ - lib/pubid/cen_pfs/adopted_base.rb
407
408
  - lib/pubid/cen_pfs/builder.rb
408
409
  - lib/pubid/cen_pfs/identifier.rb
409
410
  - lib/pubid/cen_pfs/identifiers.rb
411
+ - lib/pubid/cen_pfs/identifiers/adopted_european_norm.rb
412
+ - lib/pubid/cen_pfs/identifiers/amendment.rb
413
+ - lib/pubid/cen_pfs/identifiers/cen_report.rb
414
+ - lib/pubid/cen_pfs/identifiers/cen_workshop_agreement.rb
415
+ - lib/pubid/cen_pfs/identifiers/consolidated_identifier.rb
416
+ - lib/pubid/cen_pfs/identifiers/corrigendum.rb
410
417
  - lib/pubid/cen_pfs/identifiers/european_norm.rb
418
+ - lib/pubid/cen_pfs/identifiers/european_prestandard.rb
419
+ - lib/pubid/cen_pfs/identifiers/european_specification.rb
420
+ - lib/pubid/cen_pfs/identifiers/fragment.rb
421
+ - lib/pubid/cen_pfs/identifiers/guide.rb
422
+ - lib/pubid/cen_pfs/identifiers/harmonization_document.rb
423
+ - lib/pubid/cen_pfs/identifiers/supplement.rb
424
+ - lib/pubid/cen_pfs/identifiers/technical_report.rb
425
+ - lib/pubid/cen_pfs/identifiers/technical_specification.rb
411
426
  - lib/pubid/cen_pfs/parser.rb
412
427
  - lib/pubid/cen_pfs/pubid_urn_schema.rb
413
428
  - lib/pubid/cen_pfs/renderer.rb
@@ -551,7 +566,10 @@ files:
551
566
  - lib/pubid/etsi_pfs/builder.rb
552
567
  - lib/pubid/etsi_pfs/identifier.rb
553
568
  - lib/pubid/etsi_pfs/identifiers.rb
569
+ - lib/pubid/etsi_pfs/identifiers/amendment.rb
570
+ - lib/pubid/etsi_pfs/identifiers/corrigendum.rb
554
571
  - lib/pubid/etsi_pfs/identifiers/standard.rb
572
+ - lib/pubid/etsi_pfs/identifiers/supplement.rb
555
573
  - lib/pubid/etsi_pfs/parser.rb
556
574
  - lib/pubid/etsi_pfs/pubid_urn_schema.rb
557
575
  - lib/pubid/etsi_pfs/renderer.rb