@pubid/pubid 0.1.13 → 0.1.14
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.
|
@@ -348,13 +348,19 @@ export function preprocessIeee(input) {
|
|
|
348
348
|
cleaned = cleaned.replaceAll("’", "'");
|
|
349
349
|
cleaned = cleaned.replaceAll("&", "&");
|
|
350
350
|
cleaned = cleaned.replaceAll("&", "&");
|
|
351
|
-
|
|
351
|
+
// The "P&V" print tail is NOT parenthesized: the artifact captures it
|
|
352
|
+
// and the builder discards it (the reference renders "ANSI/IEEE
|
|
353
|
+
// 500-1984" bare) — the former wrap made the parenthetical print.
|
|
352
354
|
cleaned = cleaned.replace(/(\d+\.\d+)\s+(\d+\.)/g, "$1$2");
|
|
353
355
|
cleaned = cleaned.replace(/\b(1|2)\s+(\d{3})\b/g, "$1$2");
|
|
354
356
|
// The month-year glue split ("June2010" -> "June 2010") is NOT the
|
|
355
357
|
// reference's behavior — the reference keeps the glue (the FCD ruling:
|
|
356
358
|
// "FCD-June2010" is the stage + the glued month-name date), and the
|
|
357
359
|
// split cost the FCD rows their classification.
|
|
360
|
+
// The 8802-family IEEE-led joint prefix reorders to the ISO/IEC/IEEE
|
|
361
|
+
// label (the reference's Fix 2AA): "IEEE/ISO/IEC 8802-1Q-2020" parses
|
|
362
|
+
// under the ISO/IEC label and the amendment route renders ISO-first.
|
|
363
|
+
cleaned = cleaned.replace(/^IEEE\/ISO\/IEC\s+(8802[\w.-]+)/, "ISO/IEC/IEEE $1");
|
|
358
364
|
cleaned = normalizeJointStageSpellings(cleaned);
|
|
359
365
|
cleaned = cleaned.replace(/(IEC\s+\d+(?:-\d+)?(?::\d{4})?(?:\s+(?:First\s+)?[Ee]dition\s+\d+(?:\.\d+)?\s+\d{4}-\d{2})?)\s+(IEEE\s+Std\s+\S+|IEEE\s+\S+)/g, "$1; $2");
|
|
360
366
|
cleaned = cleaned.replace(/^(IEC\s+\d+(?:-\d+)?):\d{4}(\s+(?:First\s+)?[Ee]dition\s+\d+(?:\.\d+)?\s+\d{4}-\d{2})/, "$1$2");
|
|
@@ -185,6 +185,7 @@ const yearMapping = () => ({
|
|
|
185
185
|
: new PubidDate({
|
|
186
186
|
year: String(h["year"]),
|
|
187
187
|
month: h["month"] === undefined || h["month"] === null ? undefined : String(h["month"]),
|
|
188
|
+
day: h["day"] === undefined || h["day"] === null ? undefined : String(h["day"]),
|
|
188
189
|
}),
|
|
189
190
|
});
|
|
190
191
|
const monthMapping = () => ({
|
|
@@ -193,13 +194,21 @@ const monthMapping = () => ({
|
|
|
193
194
|
toWire: (m) => m["date"]?.month,
|
|
194
195
|
fromWire: () => undefined,
|
|
195
196
|
});
|
|
197
|
+
// An Operational Bulletin's printed day ("15.III.2016") serializes flat,
|
|
198
|
+
// mirroring the reference's hash ("year"/"month"/"day" siblings).
|
|
199
|
+
const dayMapping = () => ({
|
|
200
|
+
wire: "day",
|
|
201
|
+
to: "date",
|
|
202
|
+
toWire: (m) => m["date"]?.day,
|
|
203
|
+
fromWire: () => undefined,
|
|
204
|
+
});
|
|
196
205
|
/** StandardSerialization — the single-document whitelist. */
|
|
197
206
|
const STANDARD_MAPPINGS = keyValue({ wire: "sector", to: "sector" }, { wire: "series", to: "series" }, codeKey("imp_marker", (c) => c.imp_marker), {
|
|
198
207
|
wire: "number",
|
|
199
208
|
to: "code",
|
|
200
209
|
toWire: (m) => codeOf(m)?.number,
|
|
201
210
|
fromWire: (h) => ituCodeFromHash(h),
|
|
202
|
-
}, codeKey("series_suffix", (c) => c.series_suffix), codeKey("series_suffix_spaced", (c) => (c.series_suffix_spaced ? true : undefined)), codeKey("subseries", (c) => c.subseries), codeKey("parts", (c) => (c.parts.length > 0 ? c.parts : undefined)), codeKey("qualifier", (c) => c.qualifier), codeKey("qualifier_glued", (c) => (c.qualifier_glued ? true : undefined)), { wire: "series_word", to: "series_word" }, { wire: "series_dash", to: "series_dash" }, { wire: "attachment", to: "attachment" }, { wire: "range_end", to: "range_end" }, { wire: "version", to: "version" }, yearMapping(), monthMapping(), { wire: "language", to: "language" }, { wire: "common_text_twin", to: "common_text_twin" });
|
|
211
|
+
}, codeKey("series_suffix", (c) => c.series_suffix), codeKey("series_suffix_spaced", (c) => (c.series_suffix_spaced ? true : undefined)), codeKey("subseries", (c) => c.subseries), codeKey("parts", (c) => (c.parts.length > 0 ? c.parts : undefined)), codeKey("qualifier", (c) => c.qualifier), codeKey("qualifier_glued", (c) => (c.qualifier_glued ? true : undefined)), { wire: "series_word", to: "series_word" }, { wire: "series_dash", to: "series_dash" }, { wire: "attachment", to: "attachment" }, { wire: "range_end", to: "range_end" }, { wire: "version", to: "version" }, yearMapping(), monthMapping(), dayMapping(), { wire: "language", to: "language" }, { wire: "common_text_twin", to: "common_text_twin" });
|
|
203
212
|
/**
|
|
204
213
|
* The Supplement block: sector/series/series_word are emitted ONLY for
|
|
205
214
|
* the base-less series-only form; with a base they are redundant
|
|
@@ -469,7 +469,7 @@ export class NistIdentifier extends BaseIdentifier {
|
|
|
469
469
|
if (this.errata !== undefined)
|
|
470
470
|
result += this.errata;
|
|
471
471
|
if (this.index !== undefined)
|
|
472
|
-
result += "
|
|
472
|
+
result += "indx";
|
|
473
473
|
if (this.insert !== undefined)
|
|
474
474
|
result += "insert";
|
|
475
475
|
if (this.section !== undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "TypeScript PubID identifiers: resolution, normalization and canonical hashes for every identifier in the pubid-testsuite corpus (41 standards bodies), with a conformance runner mirroring the Ruby reference",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|