@pubid/pubid 0.1.35 → 0.1.36
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.
package/artifact/corpus.json.gz
CHANGED
|
Binary file
|
|
@@ -227,10 +227,18 @@ export class IeeeDraft {
|
|
|
227
227
|
// are accepted aliases. Captures [stage, iteration]. The iteration
|
|
228
228
|
// ordinal stays short (one or two digits): a glued D= date
|
|
229
229
|
// ("-201908", the pubid#203 convention) must ride the version body
|
|
230
|
-
// verbatim, not fold into the iteration slot.
|
|
231
|
-
|
|
230
|
+
// verbatim, not fold into the iteration slot. The glued designator
|
|
231
|
+
// date decomposes ("-201908" -> year + zero-padded month): the
|
|
232
|
+
// reference's builder carries it on the parse-path Draft object
|
|
233
|
+
// (iso_stage + year + month), and the render's stage-draft guard
|
|
234
|
+
// reads the stage — a re-parse that kept it in the version body
|
|
235
|
+
// would print the type word the designator face never takes.
|
|
236
|
+
// FCD rides the stage list (the ECHO_SUFFIX spelling).
|
|
237
|
+
const compound = /=D?(PWI|NP|WD|CDV|FDIS|FCD|DIS|CD)(\d{1,2}[a-z]?)?(?:[.-](\d{1,2}[a-z]?))?(?:-(\d{4})(\d{2}))?$/;
|
|
232
238
|
let isoStage;
|
|
233
239
|
let isoIteration;
|
|
240
|
+
let glueYear;
|
|
241
|
+
let glueMonth;
|
|
234
242
|
const cm = compound.exec(body);
|
|
235
243
|
if (cm !== null) {
|
|
236
244
|
// The glued digits ride the STAGE ("D=CD1", matching the reference's
|
|
@@ -238,6 +246,8 @@ export class IeeeDraft {
|
|
|
238
246
|
// ".iter" slot ("=DIS.3").
|
|
239
247
|
isoStage = cm[1] + (cm[2] ?? "");
|
|
240
248
|
isoIteration = cm[3];
|
|
249
|
+
glueYear = cm[4];
|
|
250
|
+
glueMonth = cm[5];
|
|
241
251
|
body = body.slice(0, cm.index);
|
|
242
252
|
}
|
|
243
253
|
const monthAlt = Object.keys(DRAFT_MONTH_NAMES)
|
|
@@ -247,7 +257,16 @@ export class IeeeDraft {
|
|
|
247
257
|
const suffix = new RegExp(`(?:(, | )(${monthAlt})(?: (\\d{1,2}))?(?:, | )|, | )((?:19|20)\\d{2}[a-z]{0,2})$`);
|
|
248
258
|
const m = suffix.exec(body);
|
|
249
259
|
if (m === null) {
|
|
250
|
-
|
|
260
|
+
// A glue-consumed body ("=FDIS-201908") carries the designator's
|
|
261
|
+
// own date on the year/month slots (the parse-path Draft object's
|
|
262
|
+
// shape), so the render re-composes the glued face verbatim.
|
|
263
|
+
return new IeeeDraft({
|
|
264
|
+
version: body,
|
|
265
|
+
iso_stage: isoStage,
|
|
266
|
+
iso_iteration: isoIteration,
|
|
267
|
+
year: glueYear,
|
|
268
|
+
month: glueMonth,
|
|
269
|
+
});
|
|
251
270
|
}
|
|
252
271
|
return new IeeeDraft({
|
|
253
272
|
version: body.slice(0, m.index),
|
|
@@ -536,7 +555,15 @@ export function renderIeeeBase(id) {
|
|
|
536
555
|
// publisher -- the ISO-led joint drafts (pubid#597) print it too.
|
|
537
556
|
const shouldRenderType = /^(IEEE|AIEE)/.test(id.publisher ?? "") || isProjectDraft;
|
|
538
557
|
const stageObj = id.typed_stage;
|
|
539
|
-
|
|
558
|
+
// An ISO/IEC stage-token draft (CD1, FDIS - the draft carries the
|
|
559
|
+
// stage) is its own draft marker: the designator face it renders
|
|
560
|
+
// (".../D=CD1", pubid#203) never takes the word Draft, so the type
|
|
561
|
+
// word is skipped whatever the publisher arrangement - the joint rows
|
|
562
|
+
// ("IEEE/IEC Draft P60076-57-129/D=FDIS-201707") would otherwise
|
|
563
|
+
// print Draft on one construction path and drop it on the re-parsed
|
|
564
|
+
// designation path, and the render would not re-parse to itself.
|
|
565
|
+
const stageDraft = id.draftObject()?.isoStage !== undefined;
|
|
566
|
+
if (shouldRenderType && !stageDraft && !(stageObj?.projectStatus === true) &&
|
|
540
567
|
((id.type !== undefined && id.type.trim() !== "" && id.type !== "P") ||
|
|
541
568
|
isProjectDraft) &&
|
|
542
569
|
!/unapproved/i.test(id.draft_status ?? "")) {
|
|
@@ -1298,7 +1325,17 @@ export const JointDevelopmentClass = ieeeClass({ kind: "joint-development" }, {
|
|
|
1298
1325
|
let result = parts.join(" ");
|
|
1299
1326
|
if (id.year !== undefined && !designatorCarriesYear &&
|
|
1300
1327
|
!(ieeeDraft ?? "").endsWith(`-${id.year}`)) {
|
|
1301
|
-
|
|
1328
|
+
// The month face follows the standing month rule (the reference's
|
|
1329
|
+
// to_ieee_format): a numeric month is the glued short form
|
|
1330
|
+
// ("-2018-05", the grammar reads only two digits), a text month
|
|
1331
|
+
// the comma long form (", February 2018", which re-parses through
|
|
1332
|
+
// the joint date clause). Dropping the month published a different
|
|
1333
|
+
// date ("P90003, February 2018 (E)" printed as "P90003-2018").
|
|
1334
|
+
result += /^\d+$/.test(id.month ?? "")
|
|
1335
|
+
? `-${id.year}-${(id.month ?? "").padStart(2, "0")}`
|
|
1336
|
+
: id.month !== undefined
|
|
1337
|
+
? `, ${id.month} ${id.year}`
|
|
1338
|
+
: `-${id.year}`;
|
|
1302
1339
|
}
|
|
1303
1340
|
const marker = id["parenthetical_content"];
|
|
1304
1341
|
if (marker !== undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
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",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"doc:api": "node scripts/api-reference.mjs"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"parsanol": "0.10.
|
|
22
|
+
"parsanol": "0.10.45",
|
|
23
23
|
"yaml": "^2.5.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|