pubid 2.0.4 → 2.0.5
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 +4 -4
- data/data/bipm/update_codes.yaml +14 -0
- data/data/parg/iho.json +1 -1
- data/data/parg/iho.parg +358 -0
- data/data/parg/jis.json +1 -1
- data/data/parg/parg.json +1 -1
- data/data/parg/parg.parg +118 -0
- data/lib/pubid/bipm/CLAUDE.md +2 -0
- data/lib/pubid/bipm.rb +10 -4
- data/lib/pubid/bsi/CLAUDE.md +4 -0
- data/lib/pubid/bsi/single_identifier.rb +10 -1
- data/lib/pubid/ieee/builder.rb +6 -1
- data/lib/pubid/ietf/CLAUDE.md +2 -0
- data/lib/pubid/ietf.rb +5 -2
- data/lib/pubid/iho/CLAUDE.md +157 -81
- data/lib/pubid/iho/builder.rb +61 -16
- data/lib/pubid/iho/identifier.rb +2 -2
- data/lib/pubid/iho/identifiers/base.rb +134 -37
- data/lib/pubid/iho/renderer.rb +44 -22
- data/lib/pubid/iho/urn_generator.rb +56 -19
- data/lib/pubid/iho/urn_parser.rb +211 -40
- data/lib/pubid/iso/CLAUDE.md +32 -0
- data/lib/pubid/iso/urn_parser.rb +63 -6
- data/lib/pubid/jis/CLAUDE.md +9 -4
- data/lib/pubid/parg/backend.rb +1 -1
- data/lib/pubid/parg/model.rb +7 -2
- data/lib/pubid/parg.rb +13 -0
- data/lib/pubid/tgpp/CLAUDE.md +2 -0
- data/lib/pubid/tgpp.rb +11 -0
- data/lib/pubid/version.rb +1 -1
- metadata +4 -2
data/lib/pubid/parg/model.rb
CHANGED
|
@@ -27,7 +27,7 @@ module Pubid
|
|
|
27
27
|
source = all_parts ? input.sub(ALL_PARTS_PATTERN, "") : input
|
|
28
28
|
hash = Artifact.for(flavor).parse_and_bind(entry, source)
|
|
29
29
|
all_parts ? Backend.mark_all_parts(hash) : hash
|
|
30
|
-
rescue
|
|
30
|
+
rescue *ENGINE_ERRORS => e
|
|
31
31
|
parse_error(e, input, flavor)
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -38,12 +38,17 @@ module Pubid
|
|
|
38
38
|
register(flavor, model_class, entry)
|
|
39
39
|
model, all_parts = materialize(flavor, model_class, input)
|
|
40
40
|
all_parts ? model.to_all_parts : model
|
|
41
|
-
rescue
|
|
41
|
+
rescue *ENGINE_ERRORS => e
|
|
42
42
|
parse_error(e, input, flavor)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
private
|
|
46
46
|
|
|
47
|
+
# The uniform error contract (CLAUDE.md "One error namespace"):
|
|
48
|
+
# every grammar/binding failure surfaces as Pubid::Errors::ParseError
|
|
49
|
+
# so `rescue Pubid::Errors::Error` stays exhaustive. Binding failures
|
|
50
|
+
# raise Parsanol::PARG::BindError (< PARG::Error, NOT ParseFailed) —
|
|
51
|
+
# left unrescued it escaped Pubid.parse raw (issue #646).
|
|
47
52
|
def parse_error(error, input, flavor)
|
|
48
53
|
raise Pubid::Errors::ParseError.new(
|
|
49
54
|
error.message,
|
data/lib/pubid/parg.rb
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "parsanol"
|
|
4
|
+
|
|
3
5
|
module Pubid
|
|
4
6
|
module Parg
|
|
5
7
|
autoload :Artifact, "pubid/parg/artifact"
|
|
6
8
|
autoload :Backend, "pubid/parg/backend"
|
|
7
9
|
autoload :Model, "pubid/parg/model"
|
|
10
|
+
|
|
11
|
+
# The engine errors a PG artifact can raise while parsing or binding an
|
|
12
|
+
# input. Every one of them must surface as Pubid::Errors::ParseError —
|
|
13
|
+
# the uniform error contract (CLAUDE.md "One error namespace") makes
|
|
14
|
+
# `rescue Pubid::Errors::Error` exhaustive, and a raw Parsanol class
|
|
15
|
+
# escaping Pubid.parse bypasses every such guard (issue #646: the JIS
|
|
16
|
+
# year forms raised Parsanol::PARG::BindError raw, which is NOT a
|
|
17
|
+
# Parsanol::ParseFailed). PARG::Error carries BindError
|
|
18
|
+
# (< ArtifactError < Error) and the PARG Parse/Compile/Artifact errors;
|
|
19
|
+
# Parsanol::ParseFailed is the ruby reference engine's parse failure.
|
|
20
|
+
ENGINE_ERRORS = [Parsanol::ParseFailed, Parsanol::PARG::Error].freeze
|
|
8
21
|
end
|
|
9
22
|
end
|
data/lib/pubid/tgpp/CLAUDE.md
CHANGED
|
@@ -41,3 +41,5 @@ keeps `#matches?(other, ignore:)`.
|
|
|
41
41
|
paths and the strict comparison treats that `[]` and a nil alike — the
|
|
42
42
|
same asymmetry the `initialize_empty` note above is about, seen from the
|
|
43
43
|
matching side. relaton had two committed specs breaking on this.
|
|
44
|
+
|
|
45
|
+
- **The flavor key is `:"3gpp"`, not the derived `:tgpp` (pubid#644)**: `PrefixesSupport#prefix_flavor_key` derives the key from the Ruby constant's name (`Pubid::Tgpp` → `:tgpp`), but the external key is "3gpp" — the registry registration, the `pubid:3gpp:*` `_type` namespace and the `urn:3gpp:` URN namespace all spell it with the digit. The derived mismatch made `Pubid.prefix_flavors` attribute the "3GPP" prefix to a key **nothing is registered under**, so the router's routing table resolved `Registry.get(:tgpp)` to `nil`, `candidates_by_prefix`'s `compact` silently dropped the owner, and `Pubid.parse("3GPP TS 38.101")` — which `Pubid::Tgpp.parse` handles fine (the prefixed spelling is a normalizing parse; canonical render drops the publisher, `with_publisher: true` puts it back) — lost its prefix-owner fallback and raised. The fix is a one-line `prefix_flavor_key` override in `lib/pubid/tgpp.rb` returning `:"3gpp"`; `Pubid.prefix_flavors["3GPP"]` now reads `[:\"3gpp\"]` and `Registry.canonical_name(Pubid::Tgpp)` answers the real key. The registry-driven tripwire `spec/pubid/parse_routing_spec.rb` ("resolves every prefix table entry to a registered flavor module") is the guard that turns any future key/registry mismatch of this shape red at the table level.
|
data/lib/pubid/tgpp.rb
CHANGED
|
@@ -16,6 +16,17 @@ module Pubid
|
|
|
16
16
|
# excluded. The parser still accepts an optional leading "3GPP ".
|
|
17
17
|
PREFIXES = ["3GPP"].freeze
|
|
18
18
|
|
|
19
|
+
# The external flavor key is "3gpp" (the registry key, the `pubid:3gpp:*`
|
|
20
|
+
# `_type` namespace and the `urn:3gpp:` URN namespace), but the default
|
|
21
|
+
# derivation spells it from the Ruby constant as :tgpp. That mismatch made
|
|
22
|
+
# {Pubid.prefix_flavors} attribute "3GPP" to a key nothing is registered
|
|
23
|
+
# under, so {Pubid}'s routing table resolved the prefix to no module and
|
|
24
|
+
# the "3GPP TS …" printed form lost its prefix-owner status (pubid#644).
|
|
25
|
+
# Return the real external key, matching the registry registration below.
|
|
26
|
+
def self.prefix_flavor_key
|
|
27
|
+
:"3gpp"
|
|
28
|
+
end
|
|
29
|
+
|
|
19
30
|
autoload :Builder, "#{__dir__}/tgpp/builder"
|
|
20
31
|
autoload :Identifier, "#{__dir__}/tgpp/identifier"
|
|
21
32
|
autoload :Identifiers, "#{__dir__}/tgpp/identifiers"
|
data/lib/pubid/version.rb
CHANGED
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.
|
|
4
|
+
version: 2.0.5
|
|
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-
|
|
11
|
+
date: 2026-11-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|
|
@@ -93,6 +93,7 @@ files:
|
|
|
93
93
|
- data/parg/ieee.json
|
|
94
94
|
- data/parg/ietf.json
|
|
95
95
|
- data/parg/iho.json
|
|
96
|
+
- data/parg/iho.parg
|
|
96
97
|
- data/parg/ire.json
|
|
97
98
|
- data/parg/ire.parg
|
|
98
99
|
- data/parg/isbn.json
|
|
@@ -109,6 +110,7 @@ files:
|
|
|
109
110
|
- data/parg/oiml.json
|
|
110
111
|
- data/parg/omg.json
|
|
111
112
|
- data/parg/parg.json
|
|
113
|
+
- data/parg/parg.parg
|
|
112
114
|
- data/parg/plateau.json
|
|
113
115
|
- data/parg/sae.json
|
|
114
116
|
- data/parg/tables/bipm_groups.yaml
|