pubid 2.0.0.pre.alpha.6 → 2.0.0.pre.alpha.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 +4 -4
- data/README.adoc +49 -50
- data/lib/pubid/amca.rb +6 -0
- data/lib/pubid/ansi.rb +7 -0
- data/lib/pubid/api.rb +5 -0
- data/lib/pubid/ashrae.rb +6 -0
- data/lib/pubid/asme.rb +5 -0
- data/lib/pubid/astm.rb +5 -0
- data/lib/pubid/bsi.rb +15 -0
- data/lib/pubid/ccsds.rb +5 -0
- data/lib/pubid/cen_cenelec.rb +7 -0
- data/lib/pubid/cie.rb +5 -0
- data/lib/pubid/csa.rb +5 -0
- data/lib/pubid/etsi.rb +7 -0
- data/lib/pubid/iala/builder.rb +62 -6
- data/lib/pubid/iala/identifier.rb +11 -7
- data/lib/pubid/iala/identifiers/advice.rb +15 -0
- data/lib/pubid/iala/identifiers/annex.rb +57 -0
- data/lib/pubid/iala/identifiers/general_assembly.rb +16 -0
- data/lib/pubid/iala/identifiers/letter.rb +16 -0
- data/lib/pubid/iala/identifiers.rb +12 -8
- data/lib/pubid/iala/parser.rb +39 -8
- data/lib/pubid/iala/renderer.rb +14 -0
- data/lib/pubid/iala/urn_generator.rb +17 -0
- data/lib/pubid/iala.rb +5 -0
- data/lib/pubid/idf.rb +5 -0
- data/lib/pubid/iec.rb +8 -0
- data/lib/pubid/ieee.rb +8 -0
- data/lib/pubid/iho.rb +5 -0
- data/lib/pubid/iso.rb +6 -0
- data/lib/pubid/itu.rb +5 -0
- data/lib/pubid/jcgm.rb +5 -0
- data/lib/pubid/jis.rb +6 -0
- data/lib/pubid/nist/parser.rb +3 -1
- data/lib/pubid/nist/router.rb +1 -0
- data/lib/pubid/nist.rb +14 -0
- data/lib/pubid/oiml/builder.rb +33 -0
- data/lib/pubid/oiml/identifier.rb +1 -0
- data/lib/pubid/oiml/identifiers/bulletin.rb +101 -0
- data/lib/pubid/oiml/identifiers.rb +1 -0
- data/lib/pubid/oiml/parser.rb +43 -1
- data/lib/pubid/oiml/renderer.rb +51 -0
- data/lib/pubid/oiml/urn_generator.rb +22 -0
- data/lib/pubid/oiml.rb +5 -0
- data/lib/pubid/plateau.rb +5 -0
- data/lib/pubid/prefixes_support.rb +51 -0
- data/lib/pubid/sae.rb +6 -0
- data/lib/pubid/version.rb +1 -1
- data/lib/pubid.rb +68 -0
- metadata +8 -2
data/lib/pubid.rb
CHANGED
|
@@ -9,6 +9,11 @@ require "parslet"
|
|
|
9
9
|
# code runs.
|
|
10
10
|
require "pubid/lutaml/no_store_registration"
|
|
11
11
|
|
|
12
|
+
# Uniform, static per-flavor prefix API (Pubid::<Flavor>.prefixes). Required
|
|
13
|
+
# before the flavor autoloads below so each flavor file can `extend` it and the
|
|
14
|
+
# central JOINT_PREFIXES constant is visible when its PREFIXES is defined.
|
|
15
|
+
require "pubid/prefixes_support"
|
|
16
|
+
|
|
12
17
|
module Pubid
|
|
13
18
|
# Upper bound on the length of an identifier string accepted by any +parse+
|
|
14
19
|
# entry point. Real-world standards identifiers are well under 200 characters;
|
|
@@ -61,6 +66,21 @@ module Pubid
|
|
|
61
66
|
end
|
|
62
67
|
end
|
|
63
68
|
|
|
69
|
+
# Canonical joint / co-publication leading tokens, injected symmetrically into
|
|
70
|
+
# every participating flavor's +prefixes+ (see {PrefixesSupport}). Single
|
|
71
|
+
# source of truth: editing an entry here updates both sides at once
|
|
72
|
+
# (e.g. +"ISO/IEC"+ appears in +Pubid::Iso.prefixes+ and +Pubid::Iec.prefixes+),
|
|
73
|
+
# so co-publication symmetry can never drift. Keyed by
|
|
74
|
+
# {PrefixesSupport#prefix_flavor_key}.
|
|
75
|
+
JOINT_PREFIXES = {
|
|
76
|
+
iso: ["ISO/IEC", "IEC/ISO", "ISO/IEC/IEEE"],
|
|
77
|
+
iec: ["ISO/IEC", "IEC/ISO", "ISO/IEC/IEEE"],
|
|
78
|
+
ieee: ["ISO/IEC/IEEE"],
|
|
79
|
+
ansi: ["ANSI/ASHRAE", "ANSI/AMCA"],
|
|
80
|
+
ashrae: ["ANSI/ASHRAE"],
|
|
81
|
+
amca: ["ANSI/AMCA"],
|
|
82
|
+
}.freeze
|
|
83
|
+
|
|
64
84
|
autoload :Parser, "pubid/parser"
|
|
65
85
|
autoload :Components, "pubid/components"
|
|
66
86
|
autoload :BundledIdentifier, "pubid/bundled_identifier"
|
|
@@ -175,4 +195,52 @@ module Pubid
|
|
|
175
195
|
end
|
|
176
196
|
@flavors_loaded = true
|
|
177
197
|
end
|
|
198
|
+
|
|
199
|
+
# Static leading prefix tokens for a single flavor.
|
|
200
|
+
#
|
|
201
|
+
# @param flavor [Symbol, String] a registered flavor name (e.g. +:iso+)
|
|
202
|
+
# @return [Array<String>] the flavor's prefixes (see {PrefixesSupport})
|
|
203
|
+
# @raise [ArgumentError] if the flavor is not registered
|
|
204
|
+
def self.prefixes(flavor)
|
|
205
|
+
mod = Registry.get(flavor)
|
|
206
|
+
raise ArgumentError, "unknown flavor: #{flavor.inspect}" unless mod
|
|
207
|
+
|
|
208
|
+
mod.prefixes
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Reverse index mapping every canonical prefix token to the flavor(s) that
|
|
212
|
+
# own it — the exact routing table relaton needs. Co-published prefixes list
|
|
213
|
+
# every co-publisher (e.g. +"ISO/IEC" => [:iec, :iso]+); see the inclusion /
|
|
214
|
+
# exclusion policy documented on {PrefixesSupport}.
|
|
215
|
+
#
|
|
216
|
+
# The +:cen+ alias of +:cen_cenelec+ is de-duplicated by module identity, so a
|
|
217
|
+
# prefix is attributed to a flavor's canonical
|
|
218
|
+
# {PrefixesSupport#prefix_flavor_key} exactly once.
|
|
219
|
+
#
|
|
220
|
+
# @return [Hash{String => Array<Symbol>}] prefix token => sorted flavor keys,
|
|
221
|
+
# e.g. +{ "ISO" => [:iso], "ISO/IEC" => [:iec, :iso], ... }+
|
|
222
|
+
def self.prefix_flavors
|
|
223
|
+
index = Hash.new { |h, k| h[k] = [] }
|
|
224
|
+
each_prefix_flavor_module do |mod|
|
|
225
|
+
key = mod.prefix_flavor_key
|
|
226
|
+
mod.prefixes.each { |prefix| index[prefix] |= [key] }
|
|
227
|
+
end
|
|
228
|
+
index.transform_values(&:sort).sort.to_h
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Yields each unique flavor module that exposes +prefixes+ exactly once,
|
|
232
|
+
# collapsing alias registrations (e.g. +:cen+ and +:cen_cenelec+ both point to
|
|
233
|
+
# +Pubid::CenCenelec+) by module identity.
|
|
234
|
+
# @yieldparam mod [Module] a flavor module
|
|
235
|
+
def self.each_prefix_flavor_module
|
|
236
|
+
eager_load_flavors!
|
|
237
|
+
seen = {}
|
|
238
|
+
Registry.flavor_names.each do |flavor_name|
|
|
239
|
+
mod = Registry.get(flavor_name)
|
|
240
|
+
next if seen.key?(mod) || !mod.respond_to?(:prefixes)
|
|
241
|
+
|
|
242
|
+
seen[mod] = true
|
|
243
|
+
yield mod
|
|
244
|
+
end
|
|
245
|
+
end
|
|
178
246
|
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.0.pre.alpha.
|
|
4
|
+
version: 2.0.0.pre.alpha.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-07-
|
|
11
|
+
date: 2026-07-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|
|
@@ -339,8 +339,12 @@ files:
|
|
|
339
339
|
- lib/pubid/iala/builder.rb
|
|
340
340
|
- lib/pubid/iala/identifier.rb
|
|
341
341
|
- lib/pubid/iala/identifiers.rb
|
|
342
|
+
- lib/pubid/iala/identifiers/advice.rb
|
|
343
|
+
- lib/pubid/iala/identifiers/annex.rb
|
|
342
344
|
- lib/pubid/iala/identifiers/base.rb
|
|
345
|
+
- lib/pubid/iala/identifiers/general_assembly.rb
|
|
343
346
|
- lib/pubid/iala/identifiers/guideline.rb
|
|
347
|
+
- lib/pubid/iala/identifiers/letter.rb
|
|
344
348
|
- lib/pubid/iala/identifiers/manual.rb
|
|
345
349
|
- lib/pubid/iala/identifiers/model_course.rb
|
|
346
350
|
- lib/pubid/iala/identifiers/recommendation.rb
|
|
@@ -625,6 +629,7 @@ files:
|
|
|
625
629
|
- lib/pubid/oiml/identifiers/amendment.rb
|
|
626
630
|
- lib/pubid/oiml/identifiers/annex.rb
|
|
627
631
|
- lib/pubid/oiml/identifiers/basic_publication.rb
|
|
632
|
+
- lib/pubid/oiml/identifiers/bulletin.rb
|
|
628
633
|
- lib/pubid/oiml/identifiers/document.rb
|
|
629
634
|
- lib/pubid/oiml/identifiers/errata.rb
|
|
630
635
|
- lib/pubid/oiml/identifiers/expert_report.rb
|
|
@@ -656,6 +661,7 @@ files:
|
|
|
656
661
|
- lib/pubid/plateau/supplement_identifier.rb
|
|
657
662
|
- lib/pubid/plateau/urn_generator.rb
|
|
658
663
|
- lib/pubid/plateau/urn_parser.rb
|
|
664
|
+
- lib/pubid/prefixes_support.rb
|
|
659
665
|
- lib/pubid/renderers.rb
|
|
660
666
|
- lib/pubid/renderers/base.rb
|
|
661
667
|
- lib/pubid/renderers/directives_renderer.rb
|