pubid 2.0.50 → 2.0.52
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/parg/iala.json +1 -1
- data/data/parg/iho.json +1 -1
- data/data/parg/iho.parg +126 -33
- data/lib/pubid/iala/CLAUDE.md +54 -5
- data/lib/pubid/iala/builder.rb +13 -0
- data/lib/pubid/iala/identifier.rb +5 -0
- data/lib/pubid/iala/identifiers/publication.rb +31 -0
- data/lib/pubid/iala/identifiers.rb +1 -0
- data/lib/pubid/iala/pubid_urn_schema.rb +1 -0
- data/lib/pubid/iala/renderer.rb +2 -0
- data/lib/pubid/iala.rb +4 -2
- data/lib/pubid/iho/CLAUDE.md +89 -73
- data/lib/pubid/iho/builder.rb +135 -8
- data/lib/pubid/iho/identifiers/base.rb +38 -2
- data/lib/pubid/iho/pubid_urn_schema.rb +22 -13
- data/lib/pubid/iho/renderer.rb +11 -2
- data/lib/pubid/iho/urn.adoc +169 -0
- data/lib/pubid/iho/urn_generator.rb +143 -28
- data/lib/pubid/iho/urn_parser.rb +145 -37
- data/lib/pubid/version.rb +1 -1
- metadata +6 -7
data/data/parg/iho.parg
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Port of lib/pubid/iho/parser.rb — IHO identifiers: letter series
|
|
2
|
-
# (S/P/M/B/C), a number with
|
|
3
|
-
# tail (edition, supplement, part, annex, appendix
|
|
4
|
-
# issue, year qualifier).
|
|
2
|
+
# (S/P/M/B/C), a number with the optional S-158 series-member designator,
|
|
3
|
+
# and the full component tail (edition, supplement, part, annex, appendix
|
|
4
|
+
# + subnumber, volume, issue, year qualifier).
|
|
5
5
|
#
|
|
6
|
-
# == Component model (owner rulings, 2026-11-03
|
|
6
|
+
# == Component model (owner rulings, 2026-11-03; the S-158 series model,
|
|
7
|
+
# issue #774, 2026-11-25)
|
|
7
8
|
#
|
|
8
9
|
# Every component below is a first-class semantic component: its own
|
|
9
10
|
# named capture, its own typed binding, independently addressable in
|
|
@@ -16,11 +17,26 @@
|
|
|
16
17
|
# x.y.0 — official IHO
|
|
17
18
|
# edition is dotted
|
|
18
19
|
# x.y.z WITHOUT a year)
|
|
20
|
+
# checks_for S-158:102 checks_for string (the S-158
|
|
21
|
+
# series member: the
|
|
22
|
+
# S-100 product number
|
|
23
|
+
# whose validation
|
|
24
|
+
# checks the member
|
|
25
|
+
# specifies; the colon
|
|
26
|
+
# form is the PRIMARY
|
|
27
|
+
# designator since
|
|
28
|
+
# S-158 Ed 1.0.0)
|
|
19
29
|
# supplement Sup N (Suppl N) supplement string
|
|
20
|
-
# part Part X
|
|
21
|
-
# number, or
|
|
22
|
-
#
|
|
23
|
-
#
|
|
30
|
+
# part Part X part string (letter,
|
|
31
|
+
# number, or compound
|
|
32
|
+
# "4a"; on the S-158
|
|
33
|
+
# family a digit or
|
|
34
|
+
# SERIES-REFERENCE
|
|
35
|
+
# value is the draft-era
|
|
36
|
+
# checks spelling and
|
|
37
|
+
# REBINDS to checks_for)
|
|
38
|
+
# part -X / -S-102 (short) part string (hyphenated;
|
|
39
|
+
# same S-158 rebind)
|
|
24
40
|
# annex Annex A annex string
|
|
25
41
|
# appendix Appendix B appendix string
|
|
26
42
|
# appendix Appendix D-2 appendix_subnumber string (the -2)
|
|
@@ -56,23 +72,46 @@
|
|
|
56
72
|
# In the URN the ed- segment attaches to the node it follows, so the
|
|
57
73
|
# same positional slot records both modes.
|
|
58
74
|
#
|
|
75
|
+
# == The S-158 series model (issue #774; S-158 Ed 1.0.0 clause 2.1)
|
|
76
|
+
#
|
|
77
|
+
# S-158 "Validation Checks — Introduction and Structure" is a framework
|
|
78
|
+
# publication defining a SERIES of separate publications, each a
|
|
79
|
+
# publication of its own with its own edition stream: S-158:100 (generic
|
|
80
|
+
# checks), S-158:1xx (one product-specific check specification per S-100
|
|
81
|
+
# product; :101 = S-101 ENC, :102 = S-102 Bathymetric Surface),
|
|
82
|
+
# S-158:98 (interoperability) and S-158:128 (catalogue). `:NNN` is the
|
|
83
|
+
# official IHO product number whose checks the member specifies — NOT a
|
|
84
|
+
# part and NOT a "profile".
|
|
85
|
+
#
|
|
86
|
+
# The colon form is the PRIMARY designator since Ed 1.0.0:
|
|
87
|
+
# `S-158:102 [edition]` binds number=158 and checks_for=102 as two
|
|
88
|
+
# typed components. The draft-era spellings are NON-NORMALIZED ALIASES
|
|
89
|
+
# of the same identity (facets-spelling-only: each spelling keeps its
|
|
90
|
+
# render, equality/URN use the canonical shape):
|
|
91
|
+
#
|
|
92
|
+
# S-158 Part S-102 the expanded draft-era part face (the builder
|
|
93
|
+
# rebinds the part value onto checks_for and the
|
|
94
|
+
# edition that follows it onto the BASE edition —
|
|
95
|
+
# the parted- mis-bind of issue #775)
|
|
96
|
+
# S-158-S-102 the compact hyphenated face (same rebind)
|
|
97
|
+
# S-158 Part 102 the bare-number draft-era part face
|
|
98
|
+
#
|
|
99
|
+
# A series-reference-shaped part face rebinds only while checks_for is
|
|
100
|
+
# UNBOUND: `S-158:100 Part 2` keeps a genuine part on the member
|
|
101
|
+
# publication. A lettered part face on S-158 is unattested and stays a
|
|
102
|
+
# plain part. The colon form on any other anchor (S-44:5) is rejected
|
|
103
|
+
# by the builder: the member designator is the S-158 series device.
|
|
104
|
+
#
|
|
59
105
|
# The part has a COMPACT face, hyphenated onto the code — `IHO S-5-B`
|
|
60
|
-
# (lettered part), `IHO S-100-1` (numbered part)
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
# Series-reference parts: a check standard applied to another IHO
|
|
71
|
-
# series cites the applied series as its part — `IHO S-158 0.2.0 Part
|
|
72
|
-
# S-102` (the wild glued `S-158-102` spelling is a legacy alias whose
|
|
73
|
-
# normalization to Part S-102 needs an IHO series table; the syntax
|
|
74
|
-
# alone cannot tell it from S-100-1 = Part 1, so it currently parses
|
|
75
|
-
# as the plain number part).
|
|
106
|
+
# (lettered part), `IHO S-100-1` (numbered part) — which both parses
|
|
107
|
+
# and renders; the canonical expanded face stays `IHO S-100 x.y.z
|
|
108
|
+
# Part 1`. Gluing a part onto the code without a separator (S-5A) is
|
|
109
|
+
# DISALLOWED as a form: it cannot extend to numbered parts without
|
|
110
|
+
# ambiguity (S-1001 = series 1001 vs series 100 part 1). The four
|
|
111
|
+
# lettered bases the corpus records (S-5A, S-5B, S-8A, S-8B) are LEGACY
|
|
112
|
+
# data spellings: they still parse as aliases (S-5A == S-5 Part A) but
|
|
113
|
+
# are never rendered; the owner rules later whether to reject them
|
|
114
|
+
# outright.
|
|
76
115
|
#
|
|
77
116
|
# Two main syntaxes per the owner ruling: `IHO S-100 1.0.0` (dated =
|
|
78
117
|
# edition-specific) and `IHO S-100` (undated = edition-non-specific).
|
|
@@ -92,7 +131,45 @@
|
|
|
92
131
|
# (S-5A, parse-only), "S-100 v1..v5.1" (edition shorthand), "Issue N"
|
|
93
132
|
# (canonical (N)), the bare year (canonical Vol. N).
|
|
94
133
|
#
|
|
95
|
-
# == URN
|
|
134
|
+
# == URN emission — the IHO MRN guidance (owner adoption, 2026-11-25)
|
|
135
|
+
#
|
|
136
|
+
# The flavor emits the IHO MRN guidance form (S-100WG4, "MRN Guidelines
|
|
137
|
+
# for IHO") for the series the guidance gives a publication type:
|
|
138
|
+
#
|
|
139
|
+
# urn:mrn:iho:pub:<type>:<name>[:<edition>][:<trailing atoms>...]
|
|
140
|
+
# <type> spec (S series) | per (P series) | reg (M series)
|
|
141
|
+
# <name> sNNN — the lowercase series letter + number (the guidance's
|
|
142
|
+
# own "s57"/"s98" name form; the dotted edition is the
|
|
143
|
+
# canonical 4th segment, per IHO's printed S-98 metadata
|
|
144
|
+
# urn:mrn:iho:pub:spec:s98:1.0.0)
|
|
145
|
+
# <edition> the bare dotted x.y.z — NOT ed-prefixed
|
|
146
|
+
#
|
|
147
|
+
# The S-158 member joins the name segment hyphenated — the fleet
|
|
148
|
+
# extension of the guidance for compound publication numbers — so the
|
|
149
|
+
# edition stays in its canonical 4th position:
|
|
150
|
+
#
|
|
151
|
+
# S-158 1.0.0 -> urn:mrn:iho:pub:spec:s158:1.0.0
|
|
152
|
+
# S-158:102 1.0.0 -> urn:mrn:iho:pub:spec:s158-102:1.0.0
|
|
153
|
+
#
|
|
154
|
+
# The trailing atoms carry the components the guidance's tail slots do
|
|
155
|
+
# not model, in the containment order below, lowercase marker tokens,
|
|
156
|
+
# RFC 3986-safe, values case-preserved (identity law: part-A and part-a
|
|
157
|
+
# are distinct documents); a component's own edition rides as ed- right
|
|
158
|
+
# after it (the duality law), the Appendix subnumber hyphen-joins its
|
|
159
|
+
# appendix (appendix-D-2):
|
|
160
|
+
#
|
|
161
|
+
# [:year-<yyyy>][:sup-<n>[:ed-<x.y.z>][:year-<yyyy>]]
|
|
162
|
+
# [:part-<X>[...]][:spec-<n>[:specsub-<n>][:specvar-<X>]]
|
|
163
|
+
# [:annex-<A>[...]][:appendix-<B>[-<sub>][...]]
|
|
164
|
+
# [:vol-<n>[:issue-<n>][...]]
|
|
165
|
+
#
|
|
166
|
+
# The guidance's bare correction/clarification slots (the s57:3:1 form)
|
|
167
|
+
# are not modeled faces and reject. The B (Bibliographic) and C
|
|
168
|
+
# (Circular Letter) series have no guidance publication type code —
|
|
169
|
+
# until IHO assigns one they keep the legacy positional emission below.
|
|
170
|
+
#
|
|
171
|
+
# == Legacy positional segment grammar (decode-only for S/P/M, the
|
|
172
|
+
# emission of the B/C series)
|
|
96
173
|
#
|
|
97
174
|
# The URN mirrors the containment tree, one semantic atom per segment:
|
|
98
175
|
# Part contains Annexes; Annex contains Appendices; a D-2 subnumber is
|
|
@@ -203,7 +280,7 @@
|
|
|
203
280
|
# reference-built rules as the matched text, so the v2 tree is the v1
|
|
204
281
|
# tree plus named leaves for non-captured structure.
|
|
205
282
|
|
|
206
|
-
grammar PubidIho version "0.
|
|
283
|
+
grammar PubidIho version "0.4.0" edition 2 {
|
|
207
284
|
digit = %x30-39
|
|
208
285
|
upper = %x41-5A
|
|
209
286
|
lower = %x61-7A
|
|
@@ -213,14 +290,20 @@ grammar PubidIho version "0.3.0" edition 2 {
|
|
|
213
290
|
dot = "."
|
|
214
291
|
|
|
215
292
|
series = ("S" / "P" / "M" / "B" / "C") as type
|
|
216
|
-
|
|
217
|
-
|
|
293
|
+
number = (1*digit) as number
|
|
294
|
+
# The S-158 series-member designator (issue #774): the colon form
|
|
295
|
+
# "S-158:102" binds the member number as its own typed component
|
|
296
|
+
# (the S-100 product number whose checks the member specifies),
|
|
297
|
+
# never a glued number suffix. The builder restricts the designator
|
|
298
|
+
# to the S-158 anchor (S-44:5 rejects).
|
|
299
|
+
checks_for = ":" (1*digit) as checks_for
|
|
218
300
|
# The compact part face, hyphenated onto the code: S-5-B (lettered),
|
|
219
|
-
# S-100-1 (numbered) and S-158-S-102 (series reference
|
|
220
|
-
#
|
|
221
|
-
#
|
|
222
|
-
# dash is
|
|
223
|
-
#
|
|
301
|
+
# S-100-1 (numbered) and the draft-era S-158-S-102 (series reference,
|
|
302
|
+
# rebound to checks_for by the builder) — the dash replaces the old
|
|
303
|
+
# bare-glued suffix, so a number like S-1001 stays a whole number
|
|
304
|
+
# (the dash is what makes the part unambiguous). The dash is an
|
|
305
|
+
# inlined literal: a named dash ref here collides with the sequence's
|
|
306
|
+
# own dash node in the edition-2 tree.
|
|
224
307
|
compact_part = "-" ((("S" / "P" / "M" / "B" / "C") dash (1*digit)) / (1*digit [*letter]) / upper) as part
|
|
225
308
|
# LEGACY glued lettered bases (S-5A, S-5B, S-8A, S-8B in the corpus):
|
|
226
309
|
# parse-only aliases, never rendered. Kept because the records exist;
|
|
@@ -353,6 +436,7 @@ grammar PubidIho version "0.3.0" edition 2 {
|
|
|
353
436
|
series
|
|
354
437
|
dash
|
|
355
438
|
number
|
|
439
|
+
[checks_for]
|
|
356
440
|
[compact_part]
|
|
357
441
|
[glued]
|
|
358
442
|
[volume_short]
|
|
@@ -410,11 +494,16 @@ grammar PubidIho version "0.3.0" edition 2 {
|
|
|
410
494
|
accept "IHO S-100 1.0.0 (2024) Part A"
|
|
411
495
|
accept "IHO S-53 Ap. 1 1.0.0"
|
|
412
496
|
accept "IHO S-98 Part A 1.0.0"
|
|
497
|
+
# --- the S-158 series model (issue #774) ---
|
|
413
498
|
accept "IHO S-158:100 1.0.0"
|
|
414
499
|
accept "IHO S-158:100 Part 2 1.0.0"
|
|
500
|
+
accept "IHO S-158:102"
|
|
501
|
+
accept "IHO S-158:102 1.0.0"
|
|
502
|
+
accept "IHO S-158:128"
|
|
415
503
|
accept "IHO S-1001"
|
|
416
504
|
accept "IHO S-158 Part S-102 0.2.0"
|
|
417
505
|
accept "IHO S-158-S-102 0.2.0"
|
|
506
|
+
accept "IHO S-158 Part 102"
|
|
418
507
|
accept "IHO P-6 1.0.0 Vol. 2"
|
|
419
508
|
accept "IHO P-6 Vol. 2 1.0.1"
|
|
420
509
|
accept "IHO S-98 1.0.0 Annex A"
|
|
@@ -441,11 +530,15 @@ grammar PubidIho version "0.3.0" edition 2 {
|
|
|
441
530
|
reject "nonsense"
|
|
442
531
|
reject "IHO B-12 3.0"
|
|
443
532
|
reject "IHO P-5 1850"
|
|
533
|
+
# --- the S-158 series model: malformed colon forms (issue #774) ---
|
|
534
|
+
reject "IHO S-158:"
|
|
535
|
+
reject "IHO S-158:abc"
|
|
444
536
|
}
|
|
445
537
|
|
|
446
538
|
bindings identifier_entry {
|
|
447
539
|
type -> type (string)
|
|
448
540
|
number -> number (string)
|
|
541
|
+
checks_for -> checks_for (string)
|
|
449
542
|
part -> part (string)
|
|
450
543
|
part_edition -> part_edition (string)
|
|
451
544
|
part_year -> part_year (string)
|
data/lib/pubid/iala/CLAUDE.md
CHANGED
|
@@ -9,8 +9,9 @@ obeys.
|
|
|
9
9
|
|
|
10
10
|
## Identifier space
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
followed by a number whose shape varies per series.
|
|
12
|
+
Most IALA publications carry a coded reference: a series prefix
|
|
13
|
+
followed by a number whose shape varies per series. The rest carry no
|
|
14
|
+
code at all (see "Codeless publications" below).
|
|
14
15
|
|
|
15
16
|
| Series | Type | Numbering | Example |
|
|
16
17
|
|--------|------|-----------|---------|
|
|
@@ -24,6 +25,7 @@ followed by a number whose shape varies per series.
|
|
|
24
25
|
| X | Report (reserved) | 4 digits | `IALA X0123` |
|
|
25
26
|
| P | Resolution/Council publication (reserved) | 4 digits | `IALA P0123` |
|
|
26
27
|
| — | Annex wrapper over any base | bare or lettered | `IALA G1128 ANNEX A Ed 1.6` |
|
|
28
|
+
| — | Publication (no code) | product-URL slug | `IALA arctic-seminar-report (E)` |
|
|
27
29
|
|
|
28
30
|
The A letter is GeneralAssembly's legacy session form, not a separate
|
|
29
31
|
series: all 11 A-shaped primary docidentifiers in relaton-data-iala
|
|
@@ -35,9 +37,56 @@ through to_s and the URN; there is no Advice type.
|
|
|
35
37
|
The Annex class has no prefix of its own: it wraps a base identifier of
|
|
36
38
|
another series and preserves the annex marker case (`Annex` vs `ANNEX`).
|
|
37
39
|
X and P are reserved for future numbered series — today's reports and
|
|
38
|
-
Council publications carry no code
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
Council publications carry no code, and parse as `Publication`.
|
|
41
|
+
|
|
42
|
+
## Codeless publications (`Identifiers::Publication`)
|
|
43
|
+
|
|
44
|
+
iala.int lists reports and proceedings, the style guide, history books,
|
|
45
|
+
questionnaires and radio plans with no code. relaton-data-iala gives
|
|
46
|
+
each one its product-URL slug as docid: `IALA <slug>[ Ed <x.y>][ (E)]`
|
|
47
|
+
(162 records, `spec/fixtures/iala/identifiers/pass/iala-publications.txt`).
|
|
48
|
+
These used to be "deliberately outside this identifier space".
|
|
49
|
+
relaton#604 removed that option: `relaton index` now fails on a document
|
|
50
|
+
that no pubid parse covers.
|
|
51
|
+
|
|
52
|
+
- **The slug is `number`.** It uses the inherited attribute, so
|
|
53
|
+
`root.number` (the relaton-index key) is the slug and `to_hash` is
|
|
54
|
+
`{_type: "pubid:iala:publication", number, edition?, language?}`. No
|
|
55
|
+
padding applies.
|
|
56
|
+
- **Grammar**: `slug_identifier` is the last alternative of
|
|
57
|
+
`identifier`, so every typed code keeps priority (`IALA G1164 Ed 1.1`
|
|
58
|
+
stays a Guideline). A typed code starts upper-case and a slug
|
|
59
|
+
lower-case or with a digit. The slug has no space, so it never takes
|
|
60
|
+
` Ed …` or ` (E)`.
|
|
61
|
+
- **A slug is narrow on purpose**: two or more `[a-z0-9]` runs joined by
|
|
62
|
+
single hyphens (all 81 corpus slugs are), and the first run must not
|
|
63
|
+
look like a code (0–2 letters then digits). The first version took any
|
|
64
|
+
`[a-z0-9][a-z0-9-]*`, so `IALA s1070`, `IALA c0103-1` and
|
|
65
|
+
`IALA 1070 Ed 2.0` — typos of typed codes that used to raise — came
|
|
66
|
+
back as a `Publication` with a nil URN and an index key no row has:
|
|
67
|
+
a loud parse error turned into a quiet "no match".
|
|
68
|
+
- **The `IALA ` prefix is mandatory for a slug** (it is optional for a
|
|
69
|
+
typed code). Without it, any lower-case word would parse as IALA, and
|
|
70
|
+
`Pubid.parse` routing's `accepts_anything?` probe would then classify
|
|
71
|
+
IALA as an anything-goes flavor and stop trusting its fallback. The
|
|
72
|
+
cost: `to_s(with_publisher: false)` (`arctic-seminar-report (E)`) does
|
|
73
|
+
not parse back, unlike a typed code's (`G1164 Ed 1.1`).
|
|
74
|
+
- **`#to_urn` is nil.** `to_urn` is the organization's registered form,
|
|
75
|
+
and IALA assigns no MRN to these documents; an invented
|
|
76
|
+
`urn:mrn:iala:pub:<slug>` would also be ambiguous with the codes in
|
|
77
|
+
`UrnParser` (`guideline-…` against `g1164`). `#to_pubid_urn` names
|
|
78
|
+
them, and it escapes the first character of almost every slug
|
|
79
|
+
(`urn:pubid:iala:pub:~61rctic-seminar-report`): a `<word>-` core value
|
|
80
|
+
looks like an atom to the codec. It round-trips and is path-safe.
|
|
81
|
+
- **`to_mr_string` raises** for a Publication, as it already did for
|
|
82
|
+
every IALA id: the base `mr_edition` calls `edition.number` on IALA's
|
|
83
|
+
String edition (the BIPM/ASTM crash).
|
|
84
|
+
- **The grammar source is `pubid/pubid-grammar` `grammars/iala.parg`.**
|
|
85
|
+
`data/parg/iala.json` was baked locally from the changed source at
|
|
86
|
+
parsanol 1.5.1.0 under Ruby 3.4.8 (the CI pin: the unicode-table stamp
|
|
87
|
+
carries the baking Ruby, so a bake under another Ruby is not
|
|
88
|
+
byte-identical). A re-bake of the unchanged source under that pin
|
|
89
|
+
reproduced the previous artifact byte for byte.
|
|
41
90
|
|
|
42
91
|
## MRN URN scheme
|
|
43
92
|
|
data/lib/pubid/iala/builder.rb
CHANGED
|
@@ -8,6 +8,7 @@ module Pubid
|
|
|
8
8
|
class Builder
|
|
9
9
|
def build(parsed)
|
|
10
10
|
return build_annex(parsed) if parsed[:annex_marker]
|
|
11
|
+
return build_publication(parsed) if parsed[:slug]
|
|
11
12
|
|
|
12
13
|
type_letter = stringify(parsed[:type_letter])&.upcase
|
|
13
14
|
klass = Iala.identifier_klass_for_type_letter(type_letter)
|
|
@@ -27,6 +28,18 @@ module Pubid
|
|
|
27
28
|
|
|
28
29
|
private
|
|
29
30
|
|
|
31
|
+
# Build a codeless publication: the slug is its whole identity and
|
|
32
|
+
# goes into `number`, verbatim (no padding applies).
|
|
33
|
+
def build_publication(hash)
|
|
34
|
+
attrs = {
|
|
35
|
+
number: stringify(hash[:slug]),
|
|
36
|
+
edition: stringify(hash[:edition_value]),
|
|
37
|
+
language: stringify(hash[:language])&.upcase,
|
|
38
|
+
}.compact
|
|
39
|
+
|
|
40
|
+
Identifiers::Publication.new(**attrs)
|
|
41
|
+
end
|
|
42
|
+
|
|
30
43
|
# Build the Annex wrapper from the bound map. The base composite in
|
|
31
44
|
# the grammar stays unbound: its captures (type_letter, doc_number,
|
|
32
45
|
# …) are the only occurrence of each name on the annex path, so the
|
|
@@ -9,11 +9,15 @@ module Pubid
|
|
|
9
9
|
# IALA identifiers have the form:
|
|
10
10
|
# [IALA ]{S|R|G|M|C|X|P}<4-digit number>[-<subpart>][ Ed <edition>][ (<LangLetter>)]
|
|
11
11
|
#
|
|
12
|
+
# or, for a publication with no code (Identifiers::Publication):
|
|
13
|
+
# IALA <slug>[ Ed <edition>][ (<LangLetter>)]
|
|
14
|
+
#
|
|
12
15
|
# Examples:
|
|
13
16
|
# S1070
|
|
14
17
|
# IALA S1070 Ed 2.0
|
|
15
18
|
# R1016:ed2.0(F)
|
|
16
19
|
# C0103-1 Ed 3.0
|
|
20
|
+
# IALA arctic-seminar-report (E)
|
|
17
21
|
class Identifier < ::Pubid::Identifier
|
|
18
22
|
# Parse an IALA identifier — human form ("IALA G1199 Ed 1.0") or
|
|
19
23
|
# MRN URN ("urn:mrn:iala:pub:g1199:ed1.0") — into an identifier.
|
|
@@ -56,6 +60,7 @@ module Pubid
|
|
|
56
60
|
"pubid:iala:annex" => "Pubid::Iala::Identifiers::Annex",
|
|
57
61
|
"pubid:iala:report" => "Pubid::Iala::Identifiers::Report",
|
|
58
62
|
"pubid:iala:resolution" => "Pubid::Iala::Identifiers::Resolution",
|
|
63
|
+
"pubid:iala:publication" => "Pubid::Iala::Identifiers::Publication",
|
|
59
64
|
}.freeze
|
|
60
65
|
|
|
61
66
|
key_value do
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Iala
|
|
5
|
+
module Identifiers
|
|
6
|
+
# An IALA publication with no code: iala.int lists reports and
|
|
7
|
+
# proceedings, the style guide, history books and radio plans with
|
|
8
|
+
# no series letter or number, and its product-URL slug is the only
|
|
9
|
+
# identity the document has.
|
|
10
|
+
#
|
|
11
|
+
# The slug is held in the inherited `number` attribute, so it is
|
|
12
|
+
# also the index key (`root.number`) and serializes as `number`.
|
|
13
|
+
#
|
|
14
|
+
# Examples:
|
|
15
|
+
# IALA arctic-seminar-report
|
|
16
|
+
# IALA arctic-seminar-report (E)
|
|
17
|
+
# IALA iala-style-guide Ed 1.0 (E)
|
|
18
|
+
class Publication < Identifier
|
|
19
|
+
def self.type
|
|
20
|
+
{ key: :publication, title: "Publication", short: nil }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# IALA assigns no MRN to a codeless publication, so it has no
|
|
24
|
+
# official URN; #to_pubid_urn still names it.
|
|
25
|
+
def to_urn
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -13,6 +13,7 @@ module Pubid
|
|
|
13
13
|
autoload :Letter, "#{__dir__}/identifiers/letter"
|
|
14
14
|
autoload :Report, "#{__dir__}/identifiers/report"
|
|
15
15
|
autoload :Resolution, "#{__dir__}/identifiers/resolution"
|
|
16
|
+
autoload :Publication, "#{__dir__}/identifiers/publication"
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
end
|
|
@@ -20,6 +20,7 @@ module Pubid
|
|
|
20
20
|
type "pubid:iala:letter", "letter"
|
|
21
21
|
type "pubid:iala:manual", "manual"
|
|
22
22
|
type "pubid:iala:model-course", "mc"
|
|
23
|
+
type "pubid:iala:publication", "pub"
|
|
23
24
|
type "pubid:iala:recommendation", "rec"
|
|
24
25
|
type "pubid:iala:report", "rpt"
|
|
25
26
|
type "pubid:iala:resolution", "r"
|
data/lib/pubid/iala/renderer.rb
CHANGED
|
@@ -8,12 +8,14 @@ module Pubid
|
|
|
8
8
|
# "IALA S1070"
|
|
9
9
|
# "IALA S1070 Ed 2.0"
|
|
10
10
|
# "IALA R1016 Ed 2.0 (F)"
|
|
11
|
+
# "IALA arctic-seminar-report (E)"
|
|
11
12
|
class Renderer < ::Pubid::Renderers::Base
|
|
12
13
|
def render(context: nil, **_opts)
|
|
13
14
|
id = @id
|
|
14
15
|
|
|
15
16
|
return render_annex(id) if id.is_a?(Identifiers::Annex)
|
|
16
17
|
|
|
18
|
+
# A codeless Publication has no type letter: "IALA <slug>".
|
|
17
19
|
rendered = "#{id.publisher} #{id.type_letter}#{id.number}"
|
|
18
20
|
rendered << " Ed #{id.edition}" if id.edition
|
|
19
21
|
rendered << " (#{id.language})" if id.language
|
data/lib/pubid/iala.rb
CHANGED
|
@@ -62,12 +62,14 @@ module Pubid
|
|
|
62
62
|
|
|
63
63
|
# Look up an identifier class by its IALA type letter (S, R, G, M,
|
|
64
64
|
# C, X, P, GA) or a class-declared alias of one (GeneralAssembly
|
|
65
|
-
# answers to the legacy "A" session letter).
|
|
65
|
+
# answers to the legacy "A" session letter). A class with no letter
|
|
66
|
+
# (Publication, the codeless form) is not in this table.
|
|
66
67
|
# @param letter [String]
|
|
67
68
|
# @return [Class<Identifier>]
|
|
68
69
|
def self.identifier_klass_for_type_letter(letter)
|
|
69
70
|
@by_letter ||= identifier_types.flat_map do |klass|
|
|
70
|
-
([klass.type[:short]] + Array(klass.type_letter_aliases))
|
|
71
|
+
([klass.type[:short]] + Array(klass.type_letter_aliases))
|
|
72
|
+
.compact.map { |l| [l, klass] }
|
|
71
73
|
end.to_h
|
|
72
74
|
@by_letter.fetch(letter.to_s.upcase)
|
|
73
75
|
end
|