pubid 2.0.56 → 2.0.57

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/data/iec/stage-codes.md +13 -0
  3. data/data/parg/bsi_pfs.json +1 -1
  4. data/data/parg/calconnect_pfs.json +1 -1
  5. data/data/parg/cen_pfs.json +1 -1
  6. data/data/parg/doi_pfs.json +1 -1
  7. data/data/parg/etsi_pfs.json +1 -1
  8. data/lib/pubid/bsi_pfs/builder.rb +16 -2
  9. data/lib/pubid/bsi_pfs/identifiers/standalone_amendment.rb +31 -0
  10. data/lib/pubid/bsi_pfs/identifiers.rb +1 -0
  11. data/lib/pubid/bsi_pfs/pubid_urn_schema.rb +1 -0
  12. data/lib/pubid/bsi_pfs/renderer.rb +7 -5
  13. data/lib/pubid/bsi_pfs/urn.adoc +15 -6
  14. data/lib/pubid/bsi_pfs.rb +2 -2
  15. data/lib/pubid/calconnect_pfs.rb +1 -1
  16. data/lib/pubid/cen_pfs/builder.rb +4 -0
  17. data/lib/pubid/cen_pfs/identifier.rb +12 -8
  18. data/lib/pubid/cen_pfs/identifiers/adopted_european_norm.rb +4 -6
  19. data/lib/pubid/cen_pfs/identifiers/european_prestandard.rb +4 -6
  20. data/lib/pubid/cen_pfs.rb +1 -1
  21. data/lib/pubid/doi_pfs.rb +1 -1
  22. data/lib/pubid/etsi_pfs.rb +1 -1
  23. data/lib/pubid/iala/urn.adoc +1 -0
  24. data/lib/pubid/iec/CLAUDE.md +4 -0
  25. data/lib/pubid/iec/identifier.rb +55 -0
  26. data/lib/pubid/iec/identifiers/consolidated_identifier.rb +35 -0
  27. data/lib/pubid/iec/identifiers/international_standard.rb +7 -1
  28. data/lib/pubid/iec/identifiers/technical_report.rb +5 -1
  29. data/lib/pubid/iec/identifiers/technical_specification.rb +5 -1
  30. data/lib/pubid/iec/identifiers/vap_identifier.rb +28 -0
  31. data/lib/pubid/iec/supplement_identifier.rb +19 -0
  32. data/lib/pubid/iec/urn.adoc +18 -1
  33. data/lib/pubid/iho/urn.adoc +1 -0
  34. data/lib/pubid/version.rb +1 -1
  35. data/lib/tasks/pfs.rake +112 -0
  36. metadata +3 -1
@@ -77,6 +77,34 @@ module Pubid
77
77
  def base_document
78
78
  base&.base_document || base
79
79
  end
80
+
81
+ # MR string: the wrapped chain's MR with the VAP code (or codes —
82
+ # the multi-deliverable face prints `EXV-CMV`) appended as the final
83
+ # segment. Without it the VAP rendered the generic flat slug through
84
+ # its delegated `number`, which dropped the part and shared one slug
85
+ # with the bare base document (`IEC 60601-1:2005+AMD1:2012 CSV`
86
+ # keyed `iec.60601.2005`, the same slug as `IEC 60601-2:2005+AMD1:
87
+ # 2012 CSV` and — for a part-less base — the base itself). The
88
+ # corrigendum-over-VAP face (`CSV/COR1:2014`) composes on top of
89
+ # this, because the MrString renderer recurses into `base`.
90
+ def to_mr_string
91
+ head = base&.to_mr_string
92
+ return "" if head.nil? || head.empty?
93
+
94
+ codes = vap_codes
95
+ codes.empty? ? head : [head, codes].join(Pubid::Renderers::MrString::SEPARATOR_SUPPLEMENT)
96
+ end
97
+
98
+ private
99
+
100
+ # The deliverable codes, lowercased and joined — the multi-code face
101
+ # prints `EXV-CMV`, so the slug segment reads `exv-cmv`.
102
+ def vap_codes
103
+ Array(vap).filter_map do |code|
104
+ word = code.to_s.downcase.strip
105
+ word unless word.empty?
106
+ end.join("-")
107
+ end
80
108
  end
81
109
  end
82
110
  end
@@ -183,6 +183,25 @@ module Pubid
183
183
  segments.join(".")
184
184
  end
185
185
 
186
+ # The chain head routes through the BASE's own #to_mr_string, not the
187
+ # generic renderer recursion. The renderer renders the wrapped
188
+ # document flat, bypassing a wrapper class's own composition — so a
189
+ # corrigendum over a consolidated version
190
+ # ("IEC 60335-1:2010+AMD1:2013 CSV/COR1:2014") dropped the part and
191
+ # the whole chain behind its suffix (it keyed `iec.60335.2010_cor.1.
192
+ # 2014`, sharing the head with the bare base document). For every
193
+ # class without a #to_mr_string override the base's own path produces
194
+ # the same string the renderer would, so the standalone supplement
195
+ # chains are unchanged; where a wrapper carries one
196
+ # (VapIdentifier#to_mr_string) the full chain survives.
197
+ def to_mr_string
198
+ suffix = mr_supplement_suffix
199
+ return super if base.nil? || suffix.nil?
200
+
201
+ head = base.to_mr_string
202
+ head.empty? ? suffix : [head, suffix].join(Pubid::Renderers::MrString::SEPARATOR_SUPPLEMENT)
203
+ end
204
+
186
205
  private
187
206
 
188
207
  def settle_standalone_layout
@@ -25,7 +25,7 @@ Corpus: 12331 of 12331 pass ids parse.
25
25
  | `pubid:iec:base` | `base` | number | 0 | —
26
26
  | `pubid:iec:component-specification` | `cs` | number | 0 | —
27
27
  | `pubid:iec:conformity-assessment` | `ca` | number | 0 | —
28
- | `pubid:iec:consolidated-identifier` | `consol` | — | 1270 | —
28
+ | `pubid:iec:consolidated-identifier` | `consol` | — | 1270 | `IEC 60529:1989+AMD1:1999`
29
29
  | `pubid:iec:corrigendum` | `cor` | number | 195 | `CISPR 16-1-3:2004/COR1:2006`
30
30
  | `pubid:iec:fragment-identifier` | `fi` | — | 16 | `IEC 60050-111/AMD1/FRAG1 ED2`
31
31
  | `pubid:iec:guide` | `guide` | number | 59 | `IEC GUIDE 103:1980`
@@ -76,3 +76,20 @@ document goes from the shared type-only form to one URN per document
76
76
  (`urn:pubid:iec:wd:2457:tc-1:wdstage-FDIS`).
77
77
 
78
78
  Facet candidates (spelling-only): `languages.*.original_code`.
79
+
80
+ *Consolidated forms (issue #788)* — the `+AMD+COR` composition face. The
81
+ attestation base is `relaton-data-iec`: 2,031 records carry a consolidated
82
+ primary docidentifier (`IEC <n>[-p[-sp]]:<y>+AMD<m>:<y>[+AMD…][ CSV[/
83
+ COR<m>:<y>]]`), and their published `urn:iec:std:` values are
84
+ byte-identical to the gem's emission — the deliverable rides the S8 slot
85
+ (`csv`) and each chain member is a `plus:amd:…` / `::cor:…` adjunct after
86
+ the language slot. The bare chain (no CSV) is the same composition without
87
+ the deliverable — IEC's own citation style in the records' abstracts
88
+ ("IEC 62148-12+AMD1:2022 couvre…") — and parses as `ConsolidatedIdentifier`
89
+ (`urn:pubid:iec:consol:ids-(…)`) since pubid v1. A bare chain carries no
90
+ edition facet: the one trailing-edition face
91
+ (`IEC 60068:2005+AMD1:2012 ED2`) is unattested (0 of the 33,070 primary
92
+ docidentifiers carry one) and un-renderable (the edition would print onto
93
+ the base designation, which the grammar cannot re-parse), so it is
94
+ rejected at parse; the printed edition rides the CSV face
95
+ (`IEC 60068:2005+AMD1:2012 CSV ED1`), which parses and round-trips.
@@ -1,3 +1,4 @@
1
+ [[urn-iho]]
1
2
  = IHO URN schemes
2
3
 
3
4
  This file is the single home of the IHO flavor's URN documentation (the
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.56"
4
+ VERSION = "2.0.57"
5
5
  end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shellwords"
4
+
5
+ # The PFS tooling, wrapped for the gem's rake (issue #152).
6
+ #
7
+ # The machinery lives in pubid-grammar (scripts/pfs); these tasks run it
8
+ # against the SIBLING checkout (../pubid-grammar, or PUBID_GRAMMAR_PATH)
9
+ # — the grammar repo is the SSOT and the commands mutate only there.
10
+ #
11
+ # rake pfs:new[Acme,scheme=acme,out=definitions/acme.pfs]
12
+ # rake pfs:lint[definitions/acme.pfs]
13
+ # rake pfs:doctor the drift checks (pin, freshness,
14
+ # contracts, gem parity, attestation)
15
+ # rake pfs:capture[specimen.txt,scheme=acme,out=draft.pfs]
16
+ # rake pfs:cutover[acme_pfs] the dev-alias -> canonical gates
17
+ #
18
+ # The first bracketed value is the positional argument; the rest are
19
+ # name=value options (rake delivers them verbatim, so the tasks parse
20
+ # them). The doctor's gem-parity check reads THIS checkout's data/parg/
21
+ # — so `rake pfs:doctor` from the gem is the consumer-side view of the
22
+ # same drift the grammar repo's doctor reports.
23
+
24
+ GRAMMAR_PATH = ENV["PUBID_GRAMMAR_PATH"] ||
25
+ File.expand_path("../../../pubid-grammar", __dir__)
26
+ PFS_CLI = File.join(GRAMMAR_PATH, "scripts/pfs")
27
+
28
+ # Runs the PFS CLI. The script carries a shebang but ships
29
+ # non-executable (the repo's convention); it is invoked as `ruby`.
30
+ def pfs_run(*args)
31
+ unless File.file?(PFS_CLI)
32
+ abort "the PFS CLI is not at #{PFS_CLI} — set PUBID_GRAMMAR_PATH " \
33
+ "to a pubid-grammar checkout"
34
+ end
35
+ ruby "#{PFS_CLI} #{args.join(' ')}"
36
+ end
37
+
38
+ # rake delivers bracketed values positionally; the name=value ones are
39
+ # parsed into --flags here.
40
+ def pfs_flags(args, *keys)
41
+ keys.filter_map do |key|
42
+ raw = args.extras.find { |e| e.start_with?("#{key}=") }
43
+ next unless raw
44
+
45
+ "--#{key} #{Shellwords.escape(raw.split('=', 2)[1])}"
46
+ end
47
+ end
48
+
49
+ def pfs_testsuite_path
50
+ ENV["PUBID_TESTSUITE_PATH"] ||
51
+ File.expand_path("../../../pubid-testsuite", __dir__)
52
+ end
53
+
54
+ def pfs_task_new(args)
55
+ org = args[:org] or abort "usage: rake pfs:new[<Org>,scheme=...,out=...]"
56
+ pfs_run("new", Shellwords.escape(org),
57
+ *pfs_flags(args, :scheme, :title, :publisher, :prefixes, :out))
58
+ end
59
+
60
+ def pfs_task_lint(args)
61
+ file = args[:file] or
62
+ abort "usage: rake pfs:lint[<definition.pfs>] " \
63
+ "(the path is relative to #{GRAMMAR_PATH})"
64
+ pfs_run("lint", Shellwords.escape(File.expand_path(file, GRAMMAR_PATH)))
65
+ end
66
+
67
+ def pfs_task_doctor
68
+ pfs_run("doctor", "--gem-root", Shellwords.escape(Dir.pwd),
69
+ "--testsuite-root", Shellwords.escape(pfs_testsuite_path))
70
+ end
71
+
72
+ def pfs_task_capture(args)
73
+ input = args[:input] or
74
+ abort "usage: rake pfs:capture[<identifiers.txt>,scheme=...,out=...]"
75
+ pfs_run("capture", Shellwords.escape(File.expand_path(input)),
76
+ *pfs_flags(args, :scheme, :title, :publisher, :out))
77
+ end
78
+
79
+ def pfs_task_cutover(args)
80
+ key = args[:key] or abort "usage: rake pfs:cutover[<org>_pfs]"
81
+ pfs_run("cutover", Shellwords.escape(key),
82
+ "--gem-root", Shellwords.escape(Dir.pwd),
83
+ "--testsuite-root", Shellwords.escape(pfs_testsuite_path))
84
+ end
85
+
86
+ namespace :pfs do
87
+ desc "Scaffold a composed flavor (rake pfs:new[Org,scheme=acme,out=P])"
88
+ task :new, [:org] do |_task, args|
89
+ pfs_task_new(args)
90
+ end
91
+
92
+ desc "Pre-compile diagnostics (rake pfs:lint[definitions/acme.pfs])"
93
+ task :lint, [:file] do |_task, args|
94
+ pfs_task_lint(args)
95
+ end
96
+
97
+ desc "Drift checks: the fleet pin, freshness, the contracts round, " \
98
+ "gem parity (this checkout's data/parg/), the attestation"
99
+ task :doctor do
100
+ pfs_task_doctor
101
+ end
102
+
103
+ desc "The lossless wizard substrate (rake pfs:capture[spec.txt,scheme=k])"
104
+ task :capture, [:input] do |_task, args|
105
+ pfs_task_capture(args)
106
+ end
107
+
108
+ desc "The dev-alias -> canonical gates + plan (rake pfs:cutover[k_pfs])"
109
+ task :cutover, [:key] do |_task, args|
110
+ pfs_task_cutover(args)
111
+ end
112
+ 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.56
4
+ version: 2.0.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -382,6 +382,7 @@ files:
382
382
  - lib/pubid/bsi_pfs/identifiers/draft_document.rb
383
383
  - lib/pubid/bsi_pfs/identifiers/publicly_available_specification.rb
384
384
  - lib/pubid/bsi_pfs/identifiers/published_document.rb
385
+ - lib/pubid/bsi_pfs/identifiers/standalone_amendment.rb
385
386
  - lib/pubid/bsi_pfs/identifiers/supplement.rb
386
387
  - lib/pubid/bsi_pfs/identifiers/technical_specification.rb
387
388
  - lib/pubid/bsi_pfs/parser.rb
@@ -1292,6 +1293,7 @@ files:
1292
1293
  - lib/tasks/conformance.rake
1293
1294
  - lib/tasks/docs.rake
1294
1295
  - lib/tasks/export.rake
1296
+ - lib/tasks/pfs.rake
1295
1297
  - lib/tasks/schema.rake
1296
1298
  - lib/tasks/website-data.json
1297
1299
  - schema/core/joint_prefixes.yaml