@pubid/pubid 0.1.3 → 0.1.4

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 (183) hide show
  1. package/artifact/corpus.json.gz +0 -0
  2. package/dist/conformance/cli.js +5 -1
  3. package/dist/flavors/amca/grammar.d.ts +4 -0
  4. package/dist/flavors/amca/grammar.js +87 -0
  5. package/dist/flavors/amca/index.d.ts +4 -0
  6. package/dist/flavors/amca/index.js +76 -0
  7. package/dist/flavors/amca/model.d.ts +29 -0
  8. package/dist/flavors/amca/model.js +146 -0
  9. package/dist/flavors/ansi/index.d.ts +24 -0
  10. package/dist/flavors/ansi/index.js +147 -0
  11. package/dist/flavors/api/grammar.d.ts +4 -0
  12. package/dist/flavors/api/grammar.js +79 -0
  13. package/dist/flavors/api/index.d.ts +4 -0
  14. package/dist/flavors/api/index.js +71 -0
  15. package/dist/flavors/api/model.d.ts +27 -0
  16. package/dist/flavors/api/model.js +114 -0
  17. package/dist/flavors/ashrae/grammar.d.ts +2 -0
  18. package/dist/flavors/ashrae/grammar.js +667 -0
  19. package/dist/flavors/ashrae/index.d.ts +4 -0
  20. package/dist/flavors/ashrae/index.js +306 -0
  21. package/dist/flavors/ashrae/model.d.ts +87 -0
  22. package/dist/flavors/ashrae/model.js +335 -0
  23. package/dist/flavors/ashrae/preprocessor.d.ts +7 -0
  24. package/dist/flavors/ashrae/preprocessor.js +44 -0
  25. package/dist/flavors/asme/grammar.d.ts +2 -0
  26. package/dist/flavors/asme/grammar.js +200 -0
  27. package/dist/flavors/asme/index.d.ts +4 -0
  28. package/dist/flavors/asme/index.js +138 -0
  29. package/dist/flavors/asme/model.d.ts +34 -0
  30. package/dist/flavors/asme/model.js +123 -0
  31. package/dist/flavors/astm/grammar.d.ts +2 -0
  32. package/dist/flavors/astm/grammar.js +110 -0
  33. package/dist/flavors/astm/index.d.ts +2 -0
  34. package/dist/flavors/astm/index.js +127 -0
  35. package/dist/flavors/astm/model.d.ts +42 -0
  36. package/dist/flavors/astm/model.js +263 -0
  37. package/dist/flavors/bipm/index.d.ts +30 -0
  38. package/dist/flavors/bipm/index.js +434 -0
  39. package/dist/flavors/bsi/grammar.d.ts +4 -0
  40. package/dist/flavors/bsi/grammar.js +535 -0
  41. package/dist/flavors/bsi/index.d.ts +4 -0
  42. package/dist/flavors/bsi/index.js +941 -0
  43. package/dist/flavors/bsi/model.d.ts +127 -0
  44. package/dist/flavors/bsi/model.js +863 -0
  45. package/dist/flavors/calconnect/index.d.ts +21 -0
  46. package/dist/flavors/calconnect/index.js +113 -0
  47. package/dist/flavors/cen_cenelec/grammar.d.ts +4 -0
  48. package/dist/flavors/cen_cenelec/grammar.js +107 -0
  49. package/dist/flavors/cen_cenelec/index.d.ts +5 -0
  50. package/dist/flavors/cen_cenelec/index.js +263 -0
  51. package/dist/flavors/cen_cenelec/model.d.ts +45 -0
  52. package/dist/flavors/cen_cenelec/model.js +490 -0
  53. package/dist/flavors/cie/grammar.d.ts +5 -0
  54. package/dist/flavors/cie/grammar.js +127 -0
  55. package/dist/flavors/cie/index.d.ts +2 -0
  56. package/dist/flavors/cie/index.js +311 -0
  57. package/dist/flavors/cie/model.d.ts +122 -0
  58. package/dist/flavors/cie/model.js +464 -0
  59. package/dist/flavors/csa/grammar.d.ts +6 -0
  60. package/dist/flavors/csa/grammar.js +239 -0
  61. package/dist/flavors/csa/index.d.ts +2 -0
  62. package/dist/flavors/csa/index.js +634 -0
  63. package/dist/flavors/csa/model.d.ts +33 -0
  64. package/dist/flavors/csa/model.js +505 -0
  65. package/dist/flavors/doi/index.d.ts +13 -0
  66. package/dist/flavors/doi/index.js +65 -0
  67. package/dist/flavors/easc/index.d.ts +4 -0
  68. package/dist/flavors/easc/index.js +107 -0
  69. package/dist/flavors/ecma/index.d.ts +4 -0
  70. package/dist/flavors/ecma/index.js +117 -0
  71. package/dist/flavors/etsi/index.d.ts +14 -0
  72. package/dist/flavors/etsi/index.js +307 -0
  73. package/dist/flavors/evs/grammar.d.ts +2 -0
  74. package/dist/flavors/evs/grammar.js +22 -0
  75. package/dist/flavors/evs/index.d.ts +2 -0
  76. package/dist/flavors/evs/index.js +24 -0
  77. package/dist/flavors/evs/model.d.ts +19 -0
  78. package/dist/flavors/evs/model.js +36 -0
  79. package/dist/flavors/gb/index.d.ts +24 -0
  80. package/dist/flavors/gb/index.js +111 -0
  81. package/dist/flavors/gost/grammar.d.ts +2 -0
  82. package/dist/flavors/gost/grammar.js +46 -0
  83. package/dist/flavors/gost/index.d.ts +2 -0
  84. package/dist/flavors/gost/index.js +165 -0
  85. package/dist/flavors/gost/model.d.ts +61 -0
  86. package/dist/flavors/gost/model.js +147 -0
  87. package/dist/flavors/gost/prefix_routes.d.ts +15 -0
  88. package/dist/flavors/gost/prefix_routes.js +192 -0
  89. package/dist/flavors/iala/index.d.ts +32 -0
  90. package/dist/flavors/iala/index.js +300 -0
  91. package/dist/flavors/iana/index.d.ts +19 -0
  92. package/dist/flavors/iana/index.js +71 -0
  93. package/dist/flavors/idf/grammar.d.ts +2 -0
  94. package/dist/flavors/idf/grammar.js +71 -0
  95. package/dist/flavors/idf/index.d.ts +2 -0
  96. package/dist/flavors/idf/index.js +100 -0
  97. package/dist/flavors/idf/model.d.ts +54 -0
  98. package/dist/flavors/idf/model.js +359 -0
  99. package/dist/flavors/iec/grammar.d.ts +3 -0
  100. package/dist/flavors/iec/grammar.js +187 -0
  101. package/dist/flavors/iec/index.d.ts +4 -0
  102. package/dist/flavors/iec/index.js +507 -0
  103. package/dist/flavors/iec/model.d.ts +54 -0
  104. package/dist/flavors/iec/model.js +437 -0
  105. package/dist/flavors/ieee/grammar.d.ts +2 -0
  106. package/dist/flavors/ieee/grammar.js +626 -0
  107. package/dist/flavors/ieee/index.d.ts +3 -0
  108. package/dist/flavors/ieee/index.js +1186 -0
  109. package/dist/flavors/ieee/model.d.ts +142 -0
  110. package/dist/flavors/ieee/model.js +1148 -0
  111. package/dist/flavors/ieee/preprocessor.d.ts +8 -0
  112. package/dist/flavors/ieee/preprocessor.js +410 -0
  113. package/dist/flavors/ieee/update_codes.d.ts +8 -0
  114. package/dist/flavors/ieee/update_codes.js +191 -0
  115. package/dist/flavors/ietf/index.d.ts +30 -0
  116. package/dist/flavors/ietf/index.js +151 -0
  117. package/dist/flavors/iho/index.d.ts +4 -0
  118. package/dist/flavors/iho/index.js +126 -0
  119. package/dist/flavors/index.d.ts +9 -0
  120. package/dist/flavors/index.js +136 -0
  121. package/dist/flavors/isbn/index.d.ts +13 -0
  122. package/dist/flavors/isbn/index.js +97 -0
  123. package/dist/flavors/iso/grammar.d.ts +2 -0
  124. package/dist/flavors/iso/grammar.js +207 -0
  125. package/dist/flavors/iso/index.d.ts +2 -0
  126. package/dist/flavors/iso/index.js +343 -0
  127. package/dist/flavors/iso/model.d.ts +159 -0
  128. package/dist/flavors/iso/model.js +802 -0
  129. package/dist/flavors/iso/stages.generated.d.ts +13 -0
  130. package/dist/flavors/iso/stages.generated.js +391 -0
  131. package/dist/flavors/itu/grammar.d.ts +4 -0
  132. package/dist/flavors/itu/grammar.js +205 -0
  133. package/dist/flavors/itu/index.d.ts +2 -0
  134. package/dist/flavors/itu/index.js +224 -0
  135. package/dist/flavors/itu/model.d.ts +184 -0
  136. package/dist/flavors/itu/model.js +599 -0
  137. package/dist/flavors/jcgm/index.d.ts +7 -0
  138. package/dist/flavors/jcgm/index.js +300 -0
  139. package/dist/flavors/jis/index.d.ts +4 -0
  140. package/dist/flavors/jis/index.js +267 -0
  141. package/dist/flavors/nist/grammar.d.ts +2 -0
  142. package/dist/flavors/nist/grammar.js +287 -0
  143. package/dist/flavors/nist/index.d.ts +2 -0
  144. package/dist/flavors/nist/index.js +1244 -0
  145. package/dist/flavors/nist/model.d.ts +155 -0
  146. package/dist/flavors/nist/model.js +823 -0
  147. package/dist/flavors/nist/preprocessor.d.ts +11 -0
  148. package/dist/flavors/nist/preprocessor.js +281 -0
  149. package/dist/flavors/oasis/index.d.ts +23 -0
  150. package/dist/flavors/oasis/index.js +110 -0
  151. package/dist/flavors/ogc/index.d.ts +20 -0
  152. package/dist/flavors/ogc/index.js +75 -0
  153. package/dist/flavors/oiml/grammar.d.ts +2 -0
  154. package/dist/flavors/oiml/grammar.js +180 -0
  155. package/dist/flavors/oiml/implementation.d.ts +9 -0
  156. package/dist/flavors/oiml/implementation.js +16 -0
  157. package/dist/flavors/oiml/model.d.ts +4 -0
  158. package/dist/flavors/oiml/model.js +462 -0
  159. package/dist/flavors/omg/index.d.ts +14 -0
  160. package/dist/flavors/omg/index.js +73 -0
  161. package/dist/flavors/plateau/index.d.ts +4 -0
  162. package/dist/flavors/plateau/index.js +97 -0
  163. package/dist/flavors/tgpp/index.d.ts +4 -0
  164. package/dist/flavors/tgpp/index.js +122 -0
  165. package/dist/flavors/un/index.d.ts +13 -0
  166. package/dist/flavors/un/index.js +90 -0
  167. package/dist/flavors/w3c/index.d.ts +14 -0
  168. package/dist/flavors/w3c/index.js +148 -0
  169. package/dist/flavors/xsf/index.d.ts +18 -0
  170. package/dist/flavors/xsf/index.js +65 -0
  171. package/dist/grammar/engine.d.ts +78 -0
  172. package/dist/grammar/engine.js +351 -0
  173. package/dist/model/attribute.d.ts +54 -0
  174. package/dist/model/attribute.js +53 -0
  175. package/dist/model/builder.d.ts +39 -0
  176. package/dist/model/builder.js +124 -0
  177. package/dist/model/component.d.ts +70 -0
  178. package/dist/model/component.js +170 -0
  179. package/dist/model/identifier.d.ts +83 -0
  180. package/dist/model/identifier.js +270 -0
  181. package/dist/model/urn-generator.d.ts +27 -0
  182. package/dist/model/urn-generator.js +91 -0
  183. package/package.json +1 -1
@@ -0,0 +1,464 @@
1
+ import { BaseIdentifier, registerType } from "../../model/identifier.js";
2
+ import { extendAttributes } from "../../model/attribute.js";
3
+ import { Component } from "../../model/component.js";
4
+ import { BaseUrnGenerator } from "../../model/urn-generator.js";
5
+ /**
6
+ * Port of lib/pubid/cie/identifiers/* + components/language.rb.
7
+ * The wire hash is the raw attribute table (CIE declares no key_value
8
+ * block): number/part/iteration/part_separator flat, `language` a
9
+ * nested {code, format[, translation_year]} hash, publisher ("CIE")
10
+ * and style ("current") dropped as defaults.
11
+ */
12
+ /** The CIE Language component: four printed formats. */
13
+ export class CieLanguage extends Component {
14
+ code;
15
+ format;
16
+ translation_year;
17
+ constructor(attrs) {
18
+ super();
19
+ this.code = attrs["code"];
20
+ this.format = attrs["format"];
21
+ this.translation_year = attrs["translation_year"];
22
+ }
23
+ render() {
24
+ switch (this.format) {
25
+ case "slash":
26
+ case "slash_colon":
27
+ return `/${this.code ?? ""}`;
28
+ case "paren_year":
29
+ return ` (${this.code}-${this.translation_year})`;
30
+ default:
31
+ return `(${this.code ?? ""})`;
32
+ }
33
+ }
34
+ toWire() {
35
+ return {
36
+ code: this.code,
37
+ format: this.format,
38
+ ...(this.translation_year !== undefined ? { translation_year: this.translation_year } : {}),
39
+ };
40
+ }
41
+ }
42
+ export class CieIdentifier extends BaseIdentifier {
43
+ static attributes = extendAttributes(BaseIdentifier, {
44
+ style: { type: "string", default: "current" },
45
+ });
46
+ constructor(attrs = {}) {
47
+ super(attrs);
48
+ // Materialize the default the way lutaml does (runtime readers see
49
+ // "current" for an undated identifier; toHash still drops it).
50
+ if (this["style"] === undefined) {
51
+ this["style"] = "current";
52
+ }
53
+ }
54
+ dateSepChar() {
55
+ if (this.style === "legacy")
56
+ return "-";
57
+ if (this.style === "slash")
58
+ return "/";
59
+ return ":";
60
+ }
61
+ codeString() {
62
+ const self = this;
63
+ const number = self["number"];
64
+ if (number === undefined)
65
+ return undefined;
66
+ const part = self["part"];
67
+ const iteration = self["iteration"];
68
+ const partSeparator = self["part_separator"];
69
+ let result = number;
70
+ if (part !== undefined && iteration !== undefined) {
71
+ result += `/${part}.${iteration}`;
72
+ }
73
+ else if (iteration !== undefined) {
74
+ result += `.${iteration}`;
75
+ }
76
+ else if (part !== undefined) {
77
+ const separator = partSeparator === "slash" ? "/" : partSeparator === "dash" ? "-" : this.style === "current" ? "-" : "/";
78
+ result += `${separator}${part}`;
79
+ }
80
+ return result;
81
+ }
82
+ }
83
+ export class CieSingleIdentifier extends CieIdentifier {
84
+ static attributes = extendAttributes(CieIdentifier, {
85
+ publisher: { type: "string", default: "CIE" },
86
+ year: { type: "string" },
87
+ });
88
+ }
89
+ const CODE_ATTRS = {
90
+ number: { type: "string" },
91
+ part: { type: "string" },
92
+ iteration: { type: "string" },
93
+ part_separator: { type: "string" },
94
+ };
95
+ // ---------------------------------------------------------------------------
96
+ // URN generation (lib/pubid/cie/urn_generator.rb).
97
+ // ---------------------------------------------------------------------------
98
+ export class CieUrnGenerator extends BaseUrnGenerator {
99
+ generate() {
100
+ const id = this.identifier;
101
+ const parts = ["urn", "cie"];
102
+ const special = this.specialIdentifierTypeComponent();
103
+ if (special !== undefined)
104
+ parts.push(special);
105
+ if (this.maybeAttr("s_prefix") === true)
106
+ parts.push("s");
107
+ parts.push(this.publisherComponent());
108
+ // Only the CodeAttributes classes carry a code_string (Conference,
109
+ // Proceedings, Bundle and the supplements deliberately do not).
110
+ if (id instanceof CieStandard ||
111
+ id instanceof CieJointPublished ||
112
+ id instanceof CieDualPublished ||
113
+ id instanceof CieIdentical) {
114
+ const codeString = id.codeString();
115
+ if (codeString !== undefined)
116
+ parts.push(codeString);
117
+ }
118
+ const year = this.maybeAttr("year");
119
+ if (year !== undefined)
120
+ parts.push(String(year));
121
+ const language = this.maybeAttr("language");
122
+ if (language instanceof CieLanguage) {
123
+ if (language.code !== undefined) {
124
+ parts.push(language.code.toLowerCase());
125
+ if (language.format !== undefined)
126
+ parts.push(language.format.toLowerCase());
127
+ }
128
+ else {
129
+ parts.push(language.render().toLowerCase());
130
+ }
131
+ }
132
+ const stage = this.maybeAttr("stage");
133
+ if (stage !== undefined)
134
+ parts.push(String(stage).toLowerCase());
135
+ // style is the sole separator field; record it for dated identifiers.
136
+ if (year !== undefined)
137
+ parts.push(`sep.${this.maybeAttr("style")}`);
138
+ const iecIdentifier = this.maybeAttr("iec_identifier");
139
+ if (iecIdentifier !== undefined)
140
+ parts.push(`iec.${String(iecIdentifier)}`);
141
+ const isoReference = this.maybeAttr("iso_reference");
142
+ if (isoReference !== undefined)
143
+ parts.push(`iso.${String(isoReference)}`);
144
+ const docType = this.maybeAttr("doc_type");
145
+ if (docType !== undefined)
146
+ parts.push(`doctype.${String(docType)}`);
147
+ const ids = this.maybeAttr("ids");
148
+ if (Array.isArray(ids) && ids.length > 0) {
149
+ parts.push(`bundle.${id.toHuman()}`);
150
+ }
151
+ if (id instanceof CieTutorialBundle && id.number !== undefined) {
152
+ parts.push(`tut-bundle.${id.number}`);
153
+ }
154
+ return parts.join(":");
155
+ }
156
+ /** Base#maybe: reads a DECLARED attribute only. */
157
+ maybeAttr(name) {
158
+ const attributes = this.identifier.constructor.attributes;
159
+ if (attributes === undefined || !(name in attributes))
160
+ return undefined;
161
+ return this.identifier[name];
162
+ }
163
+ specialIdentifierTypeComponent() {
164
+ const name = this.identifier.constructor.polymorphicName;
165
+ // Mirrors the Ruby class-name regex order: /Bundle$/ also claims
166
+ // TutorialBundle, so the /TutorialBundle/ arm is unreachable.
167
+ if (name.endsWith("dual-published"))
168
+ return "dual-pub";
169
+ if (name.endsWith("identical"))
170
+ return "identical";
171
+ if (name.endsWith("joint-published"))
172
+ return "joint-pub";
173
+ if (name.endsWith("bundle"))
174
+ return "bundle";
175
+ return undefined;
176
+ }
177
+ publisherComponent() {
178
+ let pub = "cie";
179
+ const publisher = this.maybeAttr("publisher");
180
+ if (publisher !== undefined)
181
+ pub = String(publisher).toLowerCase();
182
+ const copublisher = this.maybeAttr("copublisher");
183
+ if (copublisher !== undefined) {
184
+ pub = `${pub}-${String(copublisher).toLowerCase()}`;
185
+ }
186
+ else {
187
+ const copubs = this.maybeAttr("copublishers");
188
+ if (Array.isArray(copubs) && copubs.length > 0) {
189
+ pub = `${pub}-${copubs.join("-").toLowerCase()}`;
190
+ }
191
+ }
192
+ return pub;
193
+ }
194
+ }
195
+ function attachUrn(klass) {
196
+ klass["urnGenerator"] = CieUrnGenerator;
197
+ }
198
+ // ---------------------------------------------------------------------------
199
+ // The concrete classes.
200
+ // ---------------------------------------------------------------------------
201
+ export class CieStandard extends CieSingleIdentifier {
202
+ static polymorphicName = "pubid:cie:standard";
203
+ static attributes = extendAttributes(CieSingleIdentifier, {
204
+ ...CODE_ATTRS,
205
+ s_prefix: { type: "boolean", default: false },
206
+ d_prefix: { type: "boolean", default: false },
207
+ language: { type: CieLanguage },
208
+ stage: { type: "string" },
209
+ });
210
+ render() {
211
+ const parts = ["CIE"];
212
+ if (this.stage !== undefined)
213
+ parts.push(this.stage);
214
+ if (this.d_prefix === true) {
215
+ parts.push(`D${this.codeString() ?? ""}`);
216
+ }
217
+ else {
218
+ if (this.s_prefix === true)
219
+ parts.push("S");
220
+ if (this.number !== undefined)
221
+ parts.push(this.codeString() ?? "");
222
+ }
223
+ let result = parts.join(" ");
224
+ if (this.language?.format === "slash") {
225
+ result += `/${this.language.code}`;
226
+ }
227
+ if (this.language?.format === "slash_colon") {
228
+ return result + `/${this.language.code}:${this.year}`;
229
+ }
230
+ if (this.year !== undefined && this.style === "slash") {
231
+ return result + `/${this.year}`;
232
+ }
233
+ if (this.year !== undefined) {
234
+ result += `${this.dateSepChar()}${this.year}`;
235
+ }
236
+ if (this.language !== undefined &&
237
+ this.language.format !== "slash" &&
238
+ this.language.format !== "slash_colon") {
239
+ result += this.language.render();
240
+ }
241
+ return result;
242
+ }
243
+ }
244
+ registerType(CieStandard);
245
+ attachUrn(CieStandard);
246
+ export class CieJointPublished extends CieSingleIdentifier {
247
+ static polymorphicName = "pubid:cie:joint-published";
248
+ static attributes = extendAttributes(CieSingleIdentifier, {
249
+ ...CODE_ATTRS,
250
+ copublisher: { type: "string" },
251
+ language: { type: CieLanguage },
252
+ doc_type: { type: "string" },
253
+ stage: { type: "string" },
254
+ });
255
+ render() {
256
+ const parts = ["CIE", this.copublisher ?? ""];
257
+ if (this.doc_type !== undefined)
258
+ parts.push(this.doc_type);
259
+ if (this.stage !== undefined)
260
+ parts.push(this.stage);
261
+ if (this.number !== undefined) {
262
+ let codeStr = this.codeString() ?? "";
263
+ if (this.copublisher === "IEC" && this.part !== undefined) {
264
+ codeStr = `${this.number}.${this.part}`;
265
+ }
266
+ parts.push(codeStr);
267
+ }
268
+ let result = parts.join(" ");
269
+ if (this.year !== undefined)
270
+ result += `${this.dateSepChar()}${this.year}`;
271
+ if (this.language !== undefined)
272
+ result += this.language.render();
273
+ return result;
274
+ }
275
+ }
276
+ registerType(CieJointPublished);
277
+ attachUrn(CieJointPublished);
278
+ export class CieDualPublished extends CieSingleIdentifier {
279
+ static polymorphicName = "pubid:cie:dual-published";
280
+ static attributes = extendAttributes(CieSingleIdentifier, {
281
+ ...CODE_ATTRS,
282
+ s_prefix: { type: "boolean", default: false },
283
+ iec_identifier: { type: "string" },
284
+ });
285
+ render() {
286
+ const parts = ["CIE"];
287
+ if (this.s_prefix === true)
288
+ parts.push("S");
289
+ if (this.number !== undefined)
290
+ parts.push(this.codeString() ?? "");
291
+ let result = parts.join(" ");
292
+ if (this.year !== undefined)
293
+ result += `${this.dateSepChar()}${this.year}`;
294
+ if (this.iec_identifier !== undefined)
295
+ result += `/IEC ${this.iec_identifier}`;
296
+ return result;
297
+ }
298
+ }
299
+ registerType(CieDualPublished);
300
+ attachUrn(CieDualPublished);
301
+ export class CieIdentical extends CieSingleIdentifier {
302
+ static polymorphicName = "pubid:cie:identical";
303
+ static attributes = extendAttributes(CieSingleIdentifier, {
304
+ ...CODE_ATTRS,
305
+ s_prefix: { type: "boolean", default: false },
306
+ language: { type: CieLanguage },
307
+ iso_reference: { type: "string" },
308
+ });
309
+ render() {
310
+ const parts = ["CIE"];
311
+ if (this.s_prefix === true)
312
+ parts.push("S");
313
+ if (this.number !== undefined)
314
+ parts.push(this.codeString() ?? "");
315
+ let result = parts.join(" ");
316
+ if (this.language !== undefined &&
317
+ (this.language.format === "slash_colon" ||
318
+ (this.language.format === "slash" && this.year !== undefined && this.style !== "slash"))) {
319
+ result +=
320
+ this.language.format === "slash_colon"
321
+ ? `/${this.language.code}:${this.year}`
322
+ : `/${this.language.code}${this.year}`;
323
+ }
324
+ else if (this.language?.format === "slash") {
325
+ result += `/${this.language.code}`;
326
+ }
327
+ else if (this.year !== undefined && this.style === "slash") {
328
+ result += `/${this.year}`;
329
+ }
330
+ else if (this.year !== undefined) {
331
+ result += `${this.dateSepChar()}${this.year}`;
332
+ }
333
+ if (this.language !== undefined &&
334
+ this.language.format !== "slash" &&
335
+ this.language.format !== "slash_colon") {
336
+ result += this.language.render();
337
+ }
338
+ if (this.iso_reference !== undefined)
339
+ result += ` (ISO ${this.iso_reference})`;
340
+ return result;
341
+ }
342
+ }
343
+ registerType(CieIdentical);
344
+ attachUrn(CieIdentical);
345
+ export class CieConference extends CieSingleIdentifier {
346
+ static polymorphicName = "pubid:cie:conference";
347
+ static attributes = extendAttributes(CieSingleIdentifier, {
348
+ number: { type: "string" },
349
+ amendment_number: { type: "string" },
350
+ variant: { type: "string" },
351
+ });
352
+ render() {
353
+ let result = `CIE x${this.number ?? ""}`;
354
+ if (this.year !== undefined)
355
+ result += `${this.dateSepChar()}${this.year}`;
356
+ if (this.amendment_number !== undefined)
357
+ result += ` Amendment ${this.amendment_number}`;
358
+ if (this.variant !== undefined)
359
+ result += `/${this.variant}`;
360
+ return result;
361
+ }
362
+ }
363
+ registerType(CieConference);
364
+ attachUrn(CieConference);
365
+ export class CieProceedings extends CieSingleIdentifier {
366
+ static polymorphicName = "pubid:cie:proceedings";
367
+ static attributes = extendAttributes(CieSingleIdentifier, {
368
+ number: { type: "string" },
369
+ conference: { type: "string" },
370
+ page: { type: "string" },
371
+ });
372
+ render() {
373
+ return this.conference !== undefined
374
+ ? `CIE x${this.conference}-${this.number}`
375
+ : `CIE ${this.number} ${this.page}`;
376
+ }
377
+ }
378
+ registerType(CieProceedings);
379
+ attachUrn(CieProceedings);
380
+ export class CieTutorialBundle extends CieSingleIdentifier {
381
+ static polymorphicName = "pubid:cie:tutorial-bundle";
382
+ static attributes = extendAttributes(CieSingleIdentifier, {
383
+ number: { type: "string" },
384
+ });
385
+ render() {
386
+ return `CIE Tutorials Bundle ${this.number ?? ""}`;
387
+ }
388
+ }
389
+ registerType(CieTutorialBundle);
390
+ attachUrn(CieTutorialBundle);
391
+ // --- Supplement seam (SupplementIdentifier) ---------------------------------
392
+ export class CieSupplementIdentifier extends CieIdentifier {
393
+ static attributes = extendAttributes(CieIdentifier, {
394
+ base: { type: CieIdentifier },
395
+ number: { type: "string" },
396
+ });
397
+ }
398
+ export class CieSupplement extends CieSupplementIdentifier {
399
+ static polymorphicName = "pubid:cie:supplement";
400
+ static attributes = extendAttributes(CieSupplementIdentifier, {
401
+ part: { type: "string" },
402
+ });
403
+ render() {
404
+ const b = this.base;
405
+ const parts = ["CIE"];
406
+ if (b["stage"] !== undefined && b["stage"] !== null)
407
+ parts.push(String(b["stage"]));
408
+ let core = `${b["number"] ?? ""}-SP${this.number ?? ""}`;
409
+ if (this.part !== undefined)
410
+ core += `.${this.part}`;
411
+ parts.push(core);
412
+ let result = parts.join(" ");
413
+ const language = b["language"];
414
+ if (language?.format === "slash_colon") {
415
+ result += `/${language.code}`;
416
+ }
417
+ if (b["year"] !== undefined && b["year"] !== null)
418
+ result += `:${String(b["year"])}`;
419
+ return result;
420
+ }
421
+ }
422
+ registerType(CieSupplement);
423
+ attachUrn(CieSupplement);
424
+ export class CieCorrigendum extends CieSupplementIdentifier {
425
+ static polymorphicName = "pubid:cie:corrigendum";
426
+ static attributes = extendAttributes(CieSupplementIdentifier, {
427
+ year: { type: "string" },
428
+ });
429
+ render() {
430
+ return `${this.base?.toHuman()}/Cor${this.number}:${this.year}`;
431
+ }
432
+ }
433
+ registerType(CieCorrigendum);
434
+ attachUrn(CieCorrigendum);
435
+ export class CieBundle extends CieSingleIdentifier {
436
+ static polymorphicName = "pubid:cie:bundle";
437
+ static attributes = extendAttributes(CieSingleIdentifier, {
438
+ base: { type: CieIdentifier },
439
+ ids: { type: CieIdentifier, collection: true, initializeEmpty: true },
440
+ });
441
+ render() {
442
+ if (this.ids.length === 0)
443
+ return "";
444
+ return this.ids
445
+ .map((id, i) => {
446
+ const member = id["base"] !== undefined
447
+ ? id
448
+ : this.rebased(id);
449
+ const str = member.toHuman();
450
+ return i === 0 ? str : str.replace(/^CIE /, "");
451
+ })
452
+ .join(",");
453
+ }
454
+ rebased(id) {
455
+ const rec = id;
456
+ return new CieSupplement({
457
+ base: this.base,
458
+ number: rec["number"],
459
+ part: rec["part"],
460
+ });
461
+ }
462
+ }
463
+ registerType(CieBundle);
464
+ attachUrn(CieBundle);
@@ -0,0 +1,6 @@
1
+ import { Grammar } from "../../grammar/engine.js";
2
+ export declare const csaGrammar: Grammar;
3
+ /** Parser#parse normalization (parser.rb): CONSOLIDATED, (R spacing, CEI. */
4
+ export declare function normalizeCsa(input: string): string;
5
+ /** The original publisher prefix the normalized input printed. */
6
+ export declare function csaPublisherPrefix(normalized: string): string | undefined;