@pubid/pubid 0.1.67 → 0.1.68

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.
@@ -700,6 +700,64 @@ function rejectStandaloneDottedSupplement(id) {
700
700
  node = base;
701
701
  }
702
702
  }
703
+ // --- the un-renderable trailing-edition chain reject (pubid#788) --------
704
+ // The bare consolidated chain with a trailing edition
705
+ // ("IEC 60068:2005+AMD1:2012 ED2") parses, and then cannot render: the
706
+ // edition rides the base member, so the composition prints it onto the
707
+ // base designation ("IEC 60068:2005 ED2+AMD1:2012") — a face no IEC
708
+ // source prints (0 of the 33,070 primary docidentifiers in
709
+ // relaton-data-iec carry an edition facet on a chain) and the grammar
710
+ // rejects, so parse(render) raises. The consolidated edition IS the CSV
711
+ // product ("IEC 60034-18-41:2014+AMD1:2019 CSV", the OBP PDF named
712
+ // {ed1.1}); where the printed edition appears at all it is the CSV
713
+ // face's own facet ("IEC 60068:2005+AMD1:2012 CSV ED1" — the Vap carries
714
+ // the edition after the deliverable code and renders back parseably).
715
+ // So the shape is rejected at parse — the #727 ruling for unattested,
716
+ // un-renderable faces — rather than built unrenderable. The check is the
717
+ // SHAPE on the built object, not a grammar route (the same ruling as
718
+ // rejectStandaloneDottedSupplement): a bare ConsolidatedIdentifier with
719
+ // an edition on any member, found by the gem's descend_wrapper walk (a
720
+ // node with a `base` attribute descends to it, a node with `identifiers`
721
+ // to its first member). from_hash stays open (stored-data
722
+ // compatibility): parse can no longer produce the shape and no stored
723
+ // row carries it. The edition-bearing face that DOES round-trip is the
724
+ // CSV one ("IEC 60068:2005+AMD1:2012 CSV ED1" — the edition rides the
725
+ // Vap after the deliverable code).
726
+ const CONSOLIDATED_EDITION_MESSAGE = 'the bare consolidated chain carries a trailing edition ' +
727
+ '(e.g. "IEC 60068:2005+AMD1:2012 ED2"): no IEC source prints one — ' +
728
+ "0 of the 33,070 primary docidentifiers in relaton-data-iec carry an " +
729
+ "edition facet on a chain — and the canonical render prints the " +
730
+ 'edition onto the base designation ("IEC 60068:2005 ED2+AMD1:2012"), ' +
731
+ "which cannot be re-parsed. The consolidated edition is the CSV face " +
732
+ '("IEC 60034-18-41:2014+AMD1:2019 CSV", the OBP PDF named {ed1.1}); ' +
733
+ 'where the printed edition appears it rides the CSV face ("IEC ' +
734
+ '60068:2005+AMD1:2012 CSV ED1"), which parses and round-trips';
735
+ function rejectUnrenderableConsolidatedEdition(id) {
736
+ let node = id;
737
+ while (node !== undefined) {
738
+ if (node.constructor.polymorphicName === "pubid:iec:consolidated-identifier") {
739
+ const members = node.identifiers ?? [];
740
+ if (members.some((member) => member["edition"] !== undefined &&
741
+ member["edition"] !== null)) {
742
+ throw new ParseFailed(CONSOLIDATED_EDITION_MESSAGE, 0);
743
+ }
744
+ }
745
+ // Ruby descend_wrapper: a node whose class declares a `base`
746
+ // attribute descends to it; a node with `identifiers` to its first
747
+ // member; a leaf ends the walk.
748
+ const attrs = node.constructor
749
+ .attributes;
750
+ if (attrs !== undefined && "base" in attrs) {
751
+ node = node["base"];
752
+ }
753
+ else if (attrs !== undefined && "identifiers" in attrs) {
754
+ node = node.identifiers?.[0];
755
+ }
756
+ else {
757
+ node = undefined;
758
+ }
759
+ }
760
+ }
703
761
  export function iecGrammarImplementation() {
704
762
  const builder = new IecBuilder();
705
763
  return {
@@ -748,6 +806,7 @@ export function iecGrammarImplementation() {
748
806
  // walks the base chain after ensure_base) — BSI's delegation and
749
807
  // every parse route raise through this entry; from_hash stays open.
750
808
  rejectStandaloneDottedSupplement(built);
809
+ rejectUnrenderableConsolidatedEdition(built);
751
810
  return built;
752
811
  },
753
812
  };
@@ -77,7 +77,12 @@ export const TYPED_STAGES = [
77
77
  TS("pnw", "pnw", "is", "PNW", "10.20"),
78
78
  TS("anw", "anw", "is", "ANW", "10.99", ["ANW"]),
79
79
  TS("wd", "wd", "is", "WD", "20.20"),
80
- TS("cd", "cd", "is", "CD", "30.00", [
80
+ // The CD-family rows lead the correspondence table's own CD code,
81
+ // 30.20 ("Draft circulated as CD", data/iec/stage-codes.md) — what the
82
+ // official URN stage slot carries (pubid#787, the pubid-ts#187 parity
83
+ // round). The gem's IS/TR/TS :cd/:cd_tr/:cd_ts rows flipped the same
84
+ // way; 30.00 sits in no row of the table.
85
+ TS("cd", "cd", "is", "CD", "30.20", [
81
86
  "CD", "2CD", "3CD", "4CD", "5CD", "6CD", "7CD", "8CD", "9CD",
82
87
  "ACD", "A2CD", "A3CD", "A4CD", "A5CD", "A6CD", "A7CD", "A8CD", "A9CD",
83
88
  "CDM",
@@ -93,7 +98,7 @@ export const TYPED_STAGES = [
93
98
  TS("np_tr", "np", "tr", "NP TR", "10.00"),
94
99
  TS("anw_tr", "anw", "tr", "ANW TR", "10.99"),
95
100
  TS("wd_tr", "wd", "tr", "WD TR", "20.20"),
96
- TS("cd_tr", "cd", "tr", "CD TR", "30.00"),
101
+ TS("cd_tr", "cd", "tr", "CD TR", "30.20"),
97
102
  // Plain DTR keeps the folded 50.00 ladder (the registration step); the
98
103
  // point spellings below are rows of their own, each with the exact
99
104
  // code IEC's stage-code correspondence table gives it (pubid#733, gem
@@ -111,7 +116,7 @@ export const TYPED_STAGES = [
111
116
  TS("np_ts", "np", "ts", "NP TS", "10.00"),
112
117
  TS("anw_ts", "anw", "ts", "ANW TS", "10.99"),
113
118
  TS("wd_ts", "wd", "ts", "WD TS", "20.20"),
114
- TS("cd_ts", "cd", "ts", "CD TS", "30.00"),
119
+ TS("cd_ts", "cd", "ts", "CD TS", "30.20"),
115
120
  TS("dts", "draft", "ts", "DTS", "50.00"),
116
121
  TS("adts", "draft", "ts", "ADTS", "40.99"),
117
122
  TS("cdts", "draft", "ts", "CDTS", "50.20"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubid/pubid",
3
- "version": "0.1.67",
3
+ "version": "0.1.68",
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",