pubid 2.0.56 → 2.0.58
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/iec/stage-codes.md +13 -0
- data/data/parg/bsi_pfs.json +1 -1
- data/data/parg/calconnect_pfs.json +1 -1
- data/data/parg/cen_pfs.json +1 -1
- data/data/parg/doi_pfs.json +1 -1
- data/data/parg/etsi_pfs.json +1 -1
- data/lib/pubid/bsi_pfs/builder.rb +16 -2
- data/lib/pubid/bsi_pfs/identifiers/standalone_amendment.rb +31 -0
- data/lib/pubid/bsi_pfs/identifiers.rb +1 -0
- data/lib/pubid/bsi_pfs/pubid_urn_schema.rb +1 -0
- data/lib/pubid/bsi_pfs/renderer.rb +7 -5
- data/lib/pubid/bsi_pfs/urn.adoc +15 -6
- data/lib/pubid/bsi_pfs.rb +2 -2
- data/lib/pubid/calconnect_pfs.rb +1 -1
- data/lib/pubid/cen_pfs/builder.rb +4 -0
- data/lib/pubid/cen_pfs/identifier.rb +12 -8
- data/lib/pubid/cen_pfs/identifiers/adopted_european_norm.rb +4 -6
- data/lib/pubid/cen_pfs/identifiers/european_prestandard.rb +4 -6
- data/lib/pubid/cen_pfs.rb +1 -1
- data/lib/pubid/doi_pfs.rb +1 -1
- data/lib/pubid/etsi/CLAUDE.md +18 -0
- data/lib/pubid/etsi/urn_generator.rb +4 -1
- data/lib/pubid/etsi_pfs.rb +1 -1
- data/lib/pubid/iala/urn.adoc +1 -0
- data/lib/pubid/iec/CLAUDE.md +4 -0
- data/lib/pubid/iec/identifier.rb +55 -0
- data/lib/pubid/iec/identifiers/consolidated_identifier.rb +35 -0
- data/lib/pubid/iec/identifiers/international_standard.rb +7 -1
- data/lib/pubid/iec/identifiers/technical_report.rb +5 -1
- data/lib/pubid/iec/identifiers/technical_specification.rb +5 -1
- data/lib/pubid/iec/identifiers/vap_identifier.rb +28 -0
- data/lib/pubid/iec/supplement_identifier.rb +19 -0
- data/lib/pubid/iec/urn.adoc +18 -1
- data/lib/pubid/iho/urn.adoc +1 -0
- data/lib/pubid/version.rb +1 -1
- data/lib/tasks/pfs.rake +112 -0
- metadata +4 -2
data/data/parg/etsi_pfs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"bindings":null,"version":"0.1.0","grammar":"PubidEtsiPfs","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Str":{"pattern":"ETSI "}},{"Entity":{"atom":18}},{"Str":{"pattern":"I-ETS"}},{"Str":{"pattern":"TCRTR"}},{"Str":{"pattern":"GTS"}},{"Str":{"pattern":"ETR"}},{"Str":{"pattern":"ETS"}},{"Str":{"pattern":"TBR"}},{"Str":{"pattern":"NET"}},{"Str":{"pattern":"EN"}},{"Str":{"pattern":"ES"}},{"Str":{"pattern":"EG"}},{"Str":{"pattern":"TS"}},{"Str":{"pattern":"GR"}},{"Str":{"pattern":"GS"}},{"Str":{"pattern":"SR"}},{"Str":{"pattern":"TR"}},{"Alternative":{"atoms":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}},{"Named":{"name":"type","atom":17}},{"Str":{"pattern":" "}},{"Entity":{"atom":54}},{"Str":{"pattern":"GSM"}},{"Str":{"pattern":" "}},{"Entity":{"atom":24}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":23,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Entity":{"atom":24}},{"Repetition":{"atom":27,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[21,22,25,26,28]}},{"Entity":{"atom":24}},{"Repetition":{"atom":30,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Entity":{"atom":24}},{"Repetition":{"atom":33,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[31,32,34]}},{"Entity":{"atom":40}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Alternative":{"atoms":[37,38,39]}},{"Repetition":{"atom":36,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"-"}},{"Entity":{"atom":40}},{"Repetition":{"atom":43,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[42,44]}},{"Repetition":{"atom":45,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" "}},{"Entity":{"atom":24}},{"Repetition":{"atom":48,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[41,46,47,49]}},{"Entity":{"atom":24}},{"Repetition":{"atom":51,"min":1,"max":null,"tag":"Repetition"}},{"Alternative":{"atoms":[29,35,50,52]}},{"Named":{"name":"number","atom":53}},{"Str":{"pattern":" "}},{"Entity":{"atom":59}},{"Entity":{"atom":24}},{"Repetition":{"atom":57,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"minor","atom":58}},{"Sequence":{"atoms":[55,56]}},{"Repetition":{"atom":60,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":70}},{"Str":{"pattern":"-"}},{"Entity":{"atom":67}},{"Entity":{"atom":40}},{"Repetition":{"atom":65,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"part","atom":66}},{"Sequence":{"atoms":[63,64]}},{"Repetition":{"atom":68,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"parts","atom":69}},{"Repetition":{"atom":62,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":87}},{"Entity":{"atom":85}},{"Str":{"pattern":"/"}},{"Entity":{"atom":79}},{"Str":{"pattern":"A"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[76,77]}},{"Named":{"name":"supplement_kind","atom":78}},{"Entity":{"atom":83}},{"Entity":{"atom":24}},{"Repetition":{"atom":81,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement_number","atom":82}},{"Sequence":{"atoms":[74,75,80]}},{"Named":{"name":"supplement","atom":84}},{"Repetition":{"atom":73,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplements","atom":86}},{"Str":{"pattern":" V"}},{"Entity":{"atom":95}},{"Entity":{"atom":93}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Re":{"pattern":"[.]"}},{"Alternative":{"atoms":[91,92]}},{"Repetition":{"atom":90,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"version","atom":94}},{"Sequence":{"atoms":[88,89]}},{"Str":{"pattern":" ed."}},{"Entity":{"atom":101}},{"Entity":{"atom":24}},{"Repetition":{"atom":99,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"edition","atom":100}},{"Sequence":{"atoms":[97,98]}},{"Alternative":{"atoms":[96,102]}},{"Repetition":{"atom":103,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" ("}},{"Entity":{"atom":109}},{"Entity":{"atom":24}},{"Repetition":{"atom":107,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":108}},{"Str":{"pattern":"-"}},{"Entity":{"atom":114}},{"Entity":{"atom":24}},{"Repetition":{"atom":112,"min":2,"max":2,"tag":"Repetition"}},{"Named":{"name":"month","atom":113}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[105,106,110,111,115]}},{"Repetition":{"atom":116,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[0,1,19,20,61,71,72,104,117]}},{"Str":{"pattern":"ETSI "}},{"Entity":{"atom":18}},{"Str":{"pattern":" "}},{"Entity":{"atom":54}},{"Str":{"pattern":" "}},{"Entity":{"atom":59}},{"Sequence":{"atoms":[123,124]}},{"Repetition":{"atom":125,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":70}},{"Repetition":{"atom":127,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":87}},{"Repetition":{"atom":129,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" V"}},{"Entity":{"atom":95}},{"Sequence":{"atoms":[131,132]}},{"Str":{"pattern":" ed."}},{"Entity":{"atom":101}},{"Sequence":{"atoms":[134,135]}},{"Alternative":{"atoms":[133,136]}},{"Repetition":{"atom":137,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" ("}},{"Entity":{"atom":109}},{"Str":{"pattern":"-"}},{"Entity":{"atom":114}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[139,140,141,142,143]}},{"Repetition":{"atom":144,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[119,120,121,122,126,128,130,138,145]}},{"Alternative":{"atoms":[118,146]}}],"root":147},"bindings":[{"capture":"type","path":"type","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"minor","path":"minor","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"part","path":"parts[].part","type":"string","card":null,"preprocess":null},{"capture":"version","path":"version","type":"string","card":null,"preprocess":null},{"capture":"edition","path":"edition","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"month","path":"month","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplements[].supplement","type":"raw","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule identifier: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"ETSI EG 200 053 V1.5.1 (2004-06)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI EN 300 175","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI EN 300 175-2","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI EN 300 019-1-0 V2.1.2 (2003-09)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI TS 103 702","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI EG 201 880 V1.2.1","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI GTS GSM 02.01 V5.5.0 (1999-08)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI GR NFV-EVE 008 V3.1.1 (2017-12)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI I-ETS 300 003 ed.1 (1991-08)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI ETR 108/A1 ed.1 (1995-08)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI ETS 300 092-1/A1/C1 ed.1 (1994-04)","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI XX 100","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175 V","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175 V1.2.x","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175 (","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175 (2004-6)","expect":{}},{"entry":"identifier","kind":"example","input":"ETSI EG 200 053 V1.5.1 (2004-06)","expect":{"type":"EG","number":"200 053","version":"1.5.1","year":"2004","month":"06"}},{"entry":"identifier","kind":"example","input":"ETSI EN 300 175","expect":{"type":"EN","number":"300 175"}},{"entry":"identifier","kind":"example","input":"ETSI EN 300 175-2","expect":{"type":"EN","number":"300 175","part":"2"}},{"entry":"identifier","kind":"example","input":"ETSI EN 300 019-1-0 V2.1.2 (2003-09)","expect":{"type":"EN","number":"300 019","part":"1","version":"2.1.2","year":"2003","month":"09"}},{"entry":"identifier","kind":"example","input":"ETSI TS 103 702","expect":{"type":"TS","number":"103 702"}},{"entry":"identifier","kind":"example","input":"ETSI EG 201 880 V1.2.1","expect":{"type":"EG","number":"201 880","version":"1.2.1"}},{"entry":"identifier","kind":"example","input":"ETSI GTS GSM 02.01 V5.5.0 (1999-08)","expect":{"type":"GTS","number":"GSM 02.01","version":"5.5.0","year":"1999","month":"08"}},{"entry":"identifier","kind":"example","input":"ETSI GR NFV-EVE 008 V3.1.1 (2017-12)","expect":{"type":"GR","number":"NFV-EVE 008","version":"3.1.1","year":"2017","month":"12"}},{"entry":"identifier","kind":"example","input":"ETSI I-ETS 300 003 ed.1 (1991-08)","expect":{"type":"I-ETS","number":"300 003","edition":"1","year":"1991","month":"08"}},{"entry":"identifier","kind":"example","input":"ETSI ETR 108/A1 ed.1 (1995-08)","expect":{"type":"ETR","number":"108","edition":"1","year":"1995","month":"08"}},{"entry":"identifier","kind":"example","input":"ETSI ETS 300 092-1/A1/C1 ed.1 (1994-04)","expect":{"type":"ETS","number":"300 092","part":"1","edition":"1","year":"1994","month":"04"}}],"docs":{},"source":"# PFS-generated grammar — DO NOT EDIT BY HAND.\n# Source: definitions/etsi.pfs (pfs:1) sha256:490ba9435f44dbd2d59429ae6d9527909c39444f19fec5a33a8cad91e89e3581\n# Compiler: pubid/grammar/pfs 0.1.0\n# Flavor key: etsi_pfs (grammar PubidEtsiPfs)\n# Regenerate: ruby scripts/pfs compile definitions/etsi.pfs --as etsi_pfs\n\ngrammar PubidEtsiPfs version \"0.1.0\" edition 2 {\n\n # Grammar fragments: named lexical terms declared under `grammar:`.\n digit = %x30-39\n alnum_char = %x41-5A / %x61-7A / %x30-39\n version_char = %x30-39 / %x2E\n\n # Fields: one capture rule per declared field; the whole pattern\n # is the capture.\n etsi_type = (\"I-ETS\" / \"TCRTR\" / \"GTS\" / \"ETR\" / \"ETS\" / \"TBR\" / \"NET\" / \"EN\" / \"ES\" / \"EG\" / \"TS\" / \"GR\" / \"GS\" / \"SR\" / \"TR\") as type\n etsi_number = ((\"GSM\" \" \" 1*digit \".\" 1*digit) / (1*digit \".\" 1*digit) / (1*alnum_char [(\"-\" 1*alnum_char)] \" \" 1*digit) / (1*digit)) as number\n etsi_minor = (1*digit) as minor\n etsi_part = (1*alnum_char) as part\n etsi_parts = (1*(\"-\" etsi_part)) as parts\n etsi_version = (1*version_char) as version\n etsi_edition = (1*digit) as edition\n etsi_year = (4digit) as year\n etsi_month = (2digit) as month\n\n # Supplement run (compiled from the supplements declaration):\n # each item binds its kind face and ordinal; the builder folds\n # the run into the declared wrapper classes.\n etsi_supplement_kind = (\"A\" / \"C\") as supplement_kind\n etsi_supplement_number = (1*digit) as supplement_number\n etsi_supplement = ( \"/\" etsi_supplement_kind etsi_supplement_number ) as supplement\n etsi_supplements = (1*etsi_supplement) as supplements\n\n # Identifier rule: the canonical template first, then the\n # declared alternates (parse-in spellings; they normalize to the\n # canonical render face).\n identifier = {\n \"ETSI \" etsi_type \" \" etsi_number [\" \" etsi_minor] [etsi_parts] etsi_supplements [( \" V\" etsi_version / \" ed.\" etsi_edition )] [\" (\" etsi_year \"-\" etsi_month \")\"]\n / \"ETSI \" etsi_type \" \" etsi_number [\" \" etsi_minor] [etsi_parts] [etsi_supplements] [( \" V\" etsi_version / \" ed.\" etsi_edition )] [\" (\" etsi_year \"-\" etsi_month \")\"]\n }\n entry identifier: identifier\n\n # Typed model bindings: every bound capture lands on the\n # consumer model's field of the same name.\n bindings identifier {\n type -> type (string)\n number -> number (string)\n minor -> minor (string)\n part -> part (string)\n part -> parts[].part (string)\n version -> version (string)\n edition -> edition (string)\n year -> year (string)\n month -> month (string)\n supplement -> supplements[].supplement (raw)\n }\n\n # REQUIRED examples from the definition — accepts, rejects, and\n # the capture expectations the compiler replayed at compile time.\n test {\n accept \"ETSI EG 200 053 V1.5.1 (2004-06)\"\n accept \"ETSI EN 300 175\"\n accept \"ETSI EN 300 175-2\"\n accept \"ETSI EN 300 019-1-0 V2.1.2 (2003-09)\"\n accept \"ETSI TS 103 702\"\n accept \"ETSI EG 201 880 V1.2.1\"\n accept \"ETSI GTS GSM 02.01 V5.5.0 (1999-08)\"\n accept \"ETSI GR NFV-EVE 008 V3.1.1 (2017-12)\"\n accept \"ETSI I-ETS 300 003 ed.1 (1991-08)\"\n accept \"ETSI ETR 108/A1 ed.1 (1995-08)\"\n accept \"ETSI ETS 300 092-1/A1/C1 ed.1 (1994-04)\"\n reject \"nonsense\"\n reject \"ETSI\"\n reject \"ETSI EN\"\n reject \"ETSI XX 100\"\n reject \"ETSI EN 300 175 V\"\n reject \"ETSI EN 300 175 V1.2.x\"\n reject \"ETSI EN 300 175 (\"\n reject \"ETSI EN 300 175 (2004-6)\"\n example \"ETSI EG 200 053 V1.5.1 (2004-06)\" { type: \"EG\" number: \"200 053\" version: \"1.5.1\" year: \"2004\" month: \"06\" }\n example \"ETSI EN 300 175\" { type: \"EN\" number: \"300 175\" }\n example \"ETSI EN 300 175-2\" { type: \"EN\" number: \"300 175\" part: \"2\" }\n example \"ETSI EN 300 019-1-0 V2.1.2 (2003-09)\" { type: \"EN\" number: \"300 019\" part: \"1\" version: \"2.1.2\" year: \"2003\" month: \"09\" }\n example \"ETSI TS 103 702\" { type: \"TS\" number: \"103 702\" }\n example \"ETSI EG 201 880 V1.2.1\" { type: \"EG\" number: \"201 880\" version: \"1.2.1\" }\n example \"ETSI GTS GSM 02.01 V5.5.0 (1999-08)\" { type: \"GTS\" number: \"GSM 02.01\" version: \"5.5.0\" year: \"1999\" month: \"08\" }\n example \"ETSI GR NFV-EVE 008 V3.1.1 (2017-12)\" { type: \"GR\" number: \"NFV-EVE 008\" version: \"3.1.1\" year: \"2017\" month: \"12\" }\n example \"ETSI I-ETS 300 003 ed.1 (1991-08)\" { type: \"I-ETS\" number: \"300 003\" edition: \"1\" year: \"1991\" month: \"08\" }\n example \"ETSI ETR 108/A1 ed.1 (1995-08)\" { type: \"ETR\" number: \"108\" edition: \"1\" year: \"1995\" month: \"08\" }\n example \"ETSI ETS 300 092-1/A1/C1 ed.1 (1994-04)\" { type: \"ETS\" number: \"300 092\" part: \"1\" edition: \"1\" year: \"1994\" month: \"04\" }\n }\n}\n","source_hash":"12923bc0c9d666d9c01feb4667bce45e7a3acb7b221bcdc59b4886ecbeda8f92","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:1078102d9883a5c7906a15119592a43447800ee5aaca2bbf060ac6394a089aa3","checksum":"sha256:72c56c2e65336ba732af2df8c4a3a02068cd06339301bea0953e6048825f60ed","validated":{"lint_errors":0,"lint_warnings":1,"tests_total":30,"tests_failures":0,"self_test":true}}
|
|
1
|
+
{"bindings":null,"version":"2.0.0","grammar":"PubidEtsiPfs","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Str":{"pattern":"ETSI "}},{"Entity":{"atom":18}},{"Str":{"pattern":"I-ETS"}},{"Str":{"pattern":"TCRTR"}},{"Str":{"pattern":"GTS"}},{"Str":{"pattern":"ETR"}},{"Str":{"pattern":"ETS"}},{"Str":{"pattern":"TBR"}},{"Str":{"pattern":"NET"}},{"Str":{"pattern":"EN"}},{"Str":{"pattern":"ES"}},{"Str":{"pattern":"EG"}},{"Str":{"pattern":"TS"}},{"Str":{"pattern":"GR"}},{"Str":{"pattern":"GS"}},{"Str":{"pattern":"SR"}},{"Str":{"pattern":"TR"}},{"Alternative":{"atoms":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}},{"Named":{"name":"type","atom":17}},{"Str":{"pattern":" "}},{"Entity":{"atom":54}},{"Str":{"pattern":"GSM"}},{"Str":{"pattern":" "}},{"Entity":{"atom":24}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":23,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Entity":{"atom":24}},{"Repetition":{"atom":27,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[21,22,25,26,28]}},{"Entity":{"atom":24}},{"Repetition":{"atom":30,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Entity":{"atom":24}},{"Repetition":{"atom":33,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[31,32,34]}},{"Entity":{"atom":40}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Alternative":{"atoms":[37,38,39]}},{"Repetition":{"atom":36,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"-"}},{"Entity":{"atom":40}},{"Repetition":{"atom":43,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[42,44]}},{"Repetition":{"atom":45,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" "}},{"Entity":{"atom":24}},{"Repetition":{"atom":48,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[41,46,47,49]}},{"Entity":{"atom":24}},{"Repetition":{"atom":51,"min":1,"max":null,"tag":"Repetition"}},{"Alternative":{"atoms":[29,35,50,52]}},{"Named":{"name":"number","atom":53}},{"Str":{"pattern":" "}},{"Entity":{"atom":59}},{"Entity":{"atom":24}},{"Repetition":{"atom":57,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"minor","atom":58}},{"Sequence":{"atoms":[55,56]}},{"Repetition":{"atom":60,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":70}},{"Str":{"pattern":"-"}},{"Entity":{"atom":67}},{"Entity":{"atom":40}},{"Repetition":{"atom":65,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"part","atom":66}},{"Sequence":{"atoms":[63,64]}},{"Repetition":{"atom":68,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"parts","atom":69}},{"Repetition":{"atom":62,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":87}},{"Entity":{"atom":85}},{"Str":{"pattern":"/"}},{"Entity":{"atom":79}},{"Str":{"pattern":"A"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[76,77]}},{"Named":{"name":"supplement_kind","atom":78}},{"Entity":{"atom":83}},{"Entity":{"atom":24}},{"Repetition":{"atom":81,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement_number","atom":82}},{"Sequence":{"atoms":[74,75,80]}},{"Named":{"name":"supplement","atom":84}},{"Repetition":{"atom":73,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplements","atom":86}},{"Str":{"pattern":" V"}},{"Entity":{"atom":95}},{"Entity":{"atom":93}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Re":{"pattern":"[.]"}},{"Alternative":{"atoms":[91,92]}},{"Repetition":{"atom":90,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"version","atom":94}},{"Sequence":{"atoms":[88,89]}},{"Str":{"pattern":" ed."}},{"Entity":{"atom":101}},{"Entity":{"atom":24}},{"Repetition":{"atom":99,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"edition","atom":100}},{"Sequence":{"atoms":[97,98]}},{"Alternative":{"atoms":[96,102]}},{"Repetition":{"atom":103,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" ("}},{"Entity":{"atom":109}},{"Entity":{"atom":24}},{"Repetition":{"atom":107,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":108}},{"Str":{"pattern":"-"}},{"Entity":{"atom":114}},{"Entity":{"atom":24}},{"Repetition":{"atom":112,"min":2,"max":2,"tag":"Repetition"}},{"Named":{"name":"month","atom":113}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[105,106,110,111,115]}},{"Repetition":{"atom":116,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[0,1,19,20,61,71,72,104,117]}},{"Str":{"pattern":"ETSI "}},{"Entity":{"atom":18}},{"Str":{"pattern":" "}},{"Entity":{"atom":54}},{"Str":{"pattern":" "}},{"Entity":{"atom":59}},{"Sequence":{"atoms":[123,124]}},{"Repetition":{"atom":125,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":70}},{"Repetition":{"atom":127,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":87}},{"Repetition":{"atom":129,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" V"}},{"Entity":{"atom":95}},{"Sequence":{"atoms":[131,132]}},{"Str":{"pattern":" ed."}},{"Entity":{"atom":101}},{"Sequence":{"atoms":[134,135]}},{"Alternative":{"atoms":[133,136]}},{"Repetition":{"atom":137,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" ("}},{"Entity":{"atom":109}},{"Str":{"pattern":"-"}},{"Entity":{"atom":114}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[139,140,141,142,143]}},{"Repetition":{"atom":144,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[119,120,121,122,126,128,130,138,145]}},{"Alternative":{"atoms":[118,146]}}],"root":147},"bindings":[{"capture":"type","path":"type","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"minor","path":"minor","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"part","path":"parts[].part","type":"string","card":null,"preprocess":null},{"capture":"version","path":"version","type":"string","card":null,"preprocess":null},{"capture":"edition","path":"edition","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"month","path":"month","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplements[].supplement","type":"raw","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule identifier: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"ETSI EG 200 053 V1.5.1 (2004-06)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI EN 300 175","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI EN 300 175-2","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI EN 300 019-1-0 V2.1.2 (2003-09)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI TS 103 702","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI EG 201 880 V1.2.1","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI GTS GSM 02.01 V5.5.0 (1999-08)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI GR NFV-EVE 008 V3.1.1 (2017-12)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI I-ETS 300 003 ed.1 (1991-08)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI ETR 108/A1 ed.1 (1995-08)","expect":{}},{"entry":"identifier","kind":"accept","input":"ETSI ETS 300 092-1/A1/C1 ed.1 (1994-04)","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI XX 100","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175 V","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175 V1.2.x","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175 (","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175 (2004-6)","expect":{}},{"entry":"identifier","kind":"example","input":"ETSI EG 200 053 V1.5.1 (2004-06)","expect":{"type":"EG","number":"200 053","version":"1.5.1","year":"2004","month":"06"}},{"entry":"identifier","kind":"example","input":"ETSI EN 300 175","expect":{"type":"EN","number":"300 175"}},{"entry":"identifier","kind":"example","input":"ETSI EN 300 175-2","expect":{"type":"EN","number":"300 175","part":"2"}},{"entry":"identifier","kind":"example","input":"ETSI EN 300 019-1-0 V2.1.2 (2003-09)","expect":{"type":"EN","number":"300 019","part":"1","version":"2.1.2","year":"2003","month":"09"}},{"entry":"identifier","kind":"example","input":"ETSI TS 103 702","expect":{"type":"TS","number":"103 702"}},{"entry":"identifier","kind":"example","input":"ETSI EG 201 880 V1.2.1","expect":{"type":"EG","number":"201 880","version":"1.2.1"}},{"entry":"identifier","kind":"example","input":"ETSI GTS GSM 02.01 V5.5.0 (1999-08)","expect":{"type":"GTS","number":"GSM 02.01","version":"5.5.0","year":"1999","month":"08"}},{"entry":"identifier","kind":"example","input":"ETSI GR NFV-EVE 008 V3.1.1 (2017-12)","expect":{"type":"GR","number":"NFV-EVE 008","version":"3.1.1","year":"2017","month":"12"}},{"entry":"identifier","kind":"example","input":"ETSI I-ETS 300 003 ed.1 (1991-08)","expect":{"type":"I-ETS","number":"300 003","edition":"1","year":"1991","month":"08"}},{"entry":"identifier","kind":"example","input":"ETSI ETR 108/A1 ed.1 (1995-08)","expect":{"type":"ETR","number":"108","edition":"1","year":"1995","month":"08"}},{"entry":"identifier","kind":"example","input":"ETSI ETS 300 092-1/A1/C1 ed.1 (1994-04)","expect":{"type":"ETS","number":"300 092","part":"1","edition":"1","year":"1994","month":"04"}}],"docs":{},"source":"# PFS-generated grammar — DO NOT EDIT BY HAND.\n# Source: definitions/etsi.pfs (pfs:1) sha256:490ba9435f44dbd2d59429ae6d9527909c39444f19fec5a33a8cad91e89e3581\n# Compiler: pubid/grammar/pfs 2.0.0\n# Flavor key: etsi_pfs (grammar PubidEtsiPfs)\n# Regenerate: ruby scripts/pfs compile definitions/etsi.pfs --as etsi_pfs\n\ngrammar PubidEtsiPfs version \"2.0.0\" edition 2 {\n\n # Grammar fragments: named lexical terms declared under `grammar:`.\n digit = %x30-39\n alnum_char = %x41-5A / %x61-7A / %x30-39\n version_char = %x30-39 / %x2E\n\n # Fields: one capture rule per declared field; the whole pattern\n # is the capture.\n etsi_type = (\"I-ETS\" / \"TCRTR\" / \"GTS\" / \"ETR\" / \"ETS\" / \"TBR\" / \"NET\" / \"EN\" / \"ES\" / \"EG\" / \"TS\" / \"GR\" / \"GS\" / \"SR\" / \"TR\") as type\n etsi_number = ((\"GSM\" \" \" 1*digit \".\" 1*digit) / (1*digit \".\" 1*digit) / (1*alnum_char [(\"-\" 1*alnum_char)] \" \" 1*digit) / (1*digit)) as number\n etsi_minor = (1*digit) as minor\n etsi_part = (1*alnum_char) as part\n etsi_parts = (1*(\"-\" etsi_part)) as parts\n etsi_version = (1*version_char) as version\n etsi_edition = (1*digit) as edition\n etsi_year = (4digit) as year\n etsi_month = (2digit) as month\n\n # Supplement run (compiled from the supplements declaration):\n # each item binds its kind face and ordinal; the builder folds\n # the run into the declared wrapper classes.\n etsi_supplement_kind = (\"A\" / \"C\") as supplement_kind\n etsi_supplement_number = (1*digit) as supplement_number\n etsi_supplement = ( \"/\" etsi_supplement_kind etsi_supplement_number ) as supplement\n etsi_supplements = (1*etsi_supplement) as supplements\n\n # Identifier rule: the canonical template first, then the\n # declared alternates (parse-in spellings; they normalize to the\n # canonical render face).\n identifier = {\n \"ETSI \" etsi_type \" \" etsi_number [\" \" etsi_minor] [etsi_parts] etsi_supplements [( \" V\" etsi_version / \" ed.\" etsi_edition )] [\" (\" etsi_year \"-\" etsi_month \")\"]\n / \"ETSI \" etsi_type \" \" etsi_number [\" \" etsi_minor] [etsi_parts] [etsi_supplements] [( \" V\" etsi_version / \" ed.\" etsi_edition )] [\" (\" etsi_year \"-\" etsi_month \")\"]\n }\n entry identifier: identifier\n\n # Typed model bindings: every bound capture lands on the\n # consumer model's field of the same name.\n bindings identifier {\n type -> type (string)\n number -> number (string)\n minor -> minor (string)\n part -> part (string)\n part -> parts[].part (string)\n version -> version (string)\n edition -> edition (string)\n year -> year (string)\n month -> month (string)\n supplement -> supplements[].supplement (raw)\n }\n\n # REQUIRED examples from the definition — accepts, rejects, and\n # the capture expectations the compiler replayed at compile time.\n test {\n accept \"ETSI EG 200 053 V1.5.1 (2004-06)\"\n accept \"ETSI EN 300 175\"\n accept \"ETSI EN 300 175-2\"\n accept \"ETSI EN 300 019-1-0 V2.1.2 (2003-09)\"\n accept \"ETSI TS 103 702\"\n accept \"ETSI EG 201 880 V1.2.1\"\n accept \"ETSI GTS GSM 02.01 V5.5.0 (1999-08)\"\n accept \"ETSI GR NFV-EVE 008 V3.1.1 (2017-12)\"\n accept \"ETSI I-ETS 300 003 ed.1 (1991-08)\"\n accept \"ETSI ETR 108/A1 ed.1 (1995-08)\"\n accept \"ETSI ETS 300 092-1/A1/C1 ed.1 (1994-04)\"\n reject \"nonsense\"\n reject \"ETSI\"\n reject \"ETSI EN\"\n reject \"ETSI XX 100\"\n reject \"ETSI EN 300 175 V\"\n reject \"ETSI EN 300 175 V1.2.x\"\n reject \"ETSI EN 300 175 (\"\n reject \"ETSI EN 300 175 (2004-6)\"\n example \"ETSI EG 200 053 V1.5.1 (2004-06)\" { type: \"EG\" number: \"200 053\" version: \"1.5.1\" year: \"2004\" month: \"06\" }\n example \"ETSI EN 300 175\" { type: \"EN\" number: \"300 175\" }\n example \"ETSI EN 300 175-2\" { type: \"EN\" number: \"300 175\" part: \"2\" }\n example \"ETSI EN 300 019-1-0 V2.1.2 (2003-09)\" { type: \"EN\" number: \"300 019\" part: \"1\" version: \"2.1.2\" year: \"2003\" month: \"09\" }\n example \"ETSI TS 103 702\" { type: \"TS\" number: \"103 702\" }\n example \"ETSI EG 201 880 V1.2.1\" { type: \"EG\" number: \"201 880\" version: \"1.2.1\" }\n example \"ETSI GTS GSM 02.01 V5.5.0 (1999-08)\" { type: \"GTS\" number: \"GSM 02.01\" version: \"5.5.0\" year: \"1999\" month: \"08\" }\n example \"ETSI GR NFV-EVE 008 V3.1.1 (2017-12)\" { type: \"GR\" number: \"NFV-EVE 008\" version: \"3.1.1\" year: \"2017\" month: \"12\" }\n example \"ETSI I-ETS 300 003 ed.1 (1991-08)\" { type: \"I-ETS\" number: \"300 003\" edition: \"1\" year: \"1991\" month: \"08\" }\n example \"ETSI ETR 108/A1 ed.1 (1995-08)\" { type: \"ETR\" number: \"108\" edition: \"1\" year: \"1995\" month: \"08\" }\n example \"ETSI ETS 300 092-1/A1/C1 ed.1 (1994-04)\" { type: \"ETS\" number: \"300 092\" part: \"1\" edition: \"1\" year: \"1994\" month: \"04\" }\n }\n}\n","source_hash":"ef8d4dc37c0dffda62b5a00ea31ed3739eb73add4d427261e49fea7adb6a538e","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:1de4a503190773528bcea7364987d1519558935fa7d70b2a911c8695cf2c33b0","checksum":"sha256:40e146a3eaf0e9c9bbc8d4e5677d73a7af1ff7c556f27cb36c424d6d0e088260","validated":{"lint_errors":0,"lint_warnings":1,"tests_total":30,"tests_failures":0,"self_test":true}}
|
|
@@ -8,6 +8,7 @@ module Pubid
|
|
|
8
8
|
"PD" => "PublishedDocument",
|
|
9
9
|
"DD" => "DraftDocument",
|
|
10
10
|
"TS" => "TechnicalSpecification",
|
|
11
|
+
"AMD" => "StandaloneAmendment",
|
|
11
12
|
}.freeze
|
|
12
13
|
|
|
13
14
|
DEFAULT_TYPE = "BritishStandard"
|
|
@@ -27,7 +28,9 @@ module Pubid
|
|
|
27
28
|
# token that selected the class is the designation face, not
|
|
28
29
|
# a publisher — the column keeps the class default and the
|
|
29
30
|
# identifier carries the stage entry's type/stage/typed_stage
|
|
30
|
-
# (the coded builder's cast).
|
|
31
|
+
# (the coded builder's cast). A face-only designation
|
|
32
|
+
# (designation: face) joins DESIGNATION_TOKENS without a row
|
|
33
|
+
# here — nothing serializes beyond _type.
|
|
31
34
|
DESIGNATION_STAGES = {
|
|
32
35
|
"PAS" => { code: "pubpas", stage_code: "published", type_code: "pas", abbr: ["PAS"], name: "Publicly Available Specification", harmonized_stages: ["60.00", "60.60"] },
|
|
33
36
|
"PD" => { code: "pubpd", stage_code: "published", type_code: "pd", abbr: ["PD"], name: "Published Document", harmonized_stages: ["60.00", "60.60"] },
|
|
@@ -35,6 +38,17 @@ module Pubid
|
|
|
35
38
|
"TS" => { code: "pubts", stage_code: "published", type_code: "ts", abbr: ["TS"], name: "Technical Specification", harmonized_stages: ["60.00", "60.60"] },
|
|
36
39
|
}.freeze
|
|
37
40
|
|
|
41
|
+
# Every designation token (trio and face-only): the token
|
|
42
|
+
# that selected the class never lands on the publisher
|
|
43
|
+
# column — the column keeps the organization default.
|
|
44
|
+
DESIGNATION_TOKENS = {
|
|
45
|
+
"PAS" => true,
|
|
46
|
+
"PD" => true,
|
|
47
|
+
"DD" => true,
|
|
48
|
+
"TS" => true,
|
|
49
|
+
"AMD" => true,
|
|
50
|
+
}.freeze
|
|
51
|
+
|
|
38
52
|
# The model column the adopted document lands on (the vendored
|
|
39
53
|
# hook's wrapper slot) and the declared edition face, if any.
|
|
40
54
|
ADOPTED_ATTRIBUTE = "base"
|
|
@@ -97,7 +111,7 @@ module Pubid
|
|
|
97
111
|
identifier.version = present_string(data[:version])
|
|
98
112
|
# A designation token selects the class but is not a publisher:
|
|
99
113
|
# the column keeps the class default (the organization's).
|
|
100
|
-
if data[:publisher] && !
|
|
114
|
+
if data[:publisher] && !DESIGNATION_TOKENS.key?(data[:publisher].to_s)
|
|
101
115
|
identifier.publisher = ::Pubid::Components::Publisher.new(body: data[:publisher].to_s)
|
|
102
116
|
end
|
|
103
117
|
copubs = Array(data[:copublishers]).map do |row|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Pubid
|
|
2
|
+
module BsiPfs
|
|
3
|
+
module Identifiers
|
|
4
|
+
# Concrete Standalone Amendment identifier type (PFS type `standalone_amendment`).
|
|
5
|
+
class StandaloneAmendment < Identifier
|
|
6
|
+
TYPED_STAGES = [
|
|
7
|
+
].freeze
|
|
8
|
+
|
|
9
|
+
def self.type
|
|
10
|
+
{ key: :sa, web: :standalone_amendment, title: "Standalone Amendment", short: "AMD" }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# The publisher default (feature 5): the type's own token
|
|
14
|
+
# when the type is its designation, else the scheme default.
|
|
15
|
+
def self.default_publisher
|
|
16
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
+
|
|
21
|
+
# The scheme-canonical wire tag declared in the definition:
|
|
22
|
+
# to_hash stays byte-identical with the scheme's coded
|
|
23
|
+
# flavor, and this flavor's own from_hash routes the tag
|
|
24
|
+
# to this class.
|
|
25
|
+
def self.polymorphic_name
|
|
26
|
+
"pubid:bsi:standalone-amendment"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -8,6 +8,7 @@ module Pubid
|
|
|
8
8
|
autoload :PublishedDocument, "#{__dir__}/identifiers/published_document"
|
|
9
9
|
autoload :DraftDocument, "#{__dir__}/identifiers/draft_document"
|
|
10
10
|
autoload :TechnicalSpecification, "#{__dir__}/identifiers/technical_specification"
|
|
11
|
+
autoload :StandaloneAmendment, "#{__dir__}/identifiers/standalone_amendment"
|
|
11
12
|
autoload :Supplement, "#{__dir__}/identifiers/supplement"
|
|
12
13
|
autoload :Amendment, "#{__dir__}/identifiers/amendment"
|
|
13
14
|
autoload :Corrigendum, "#{__dir__}/identifiers/corrigendum"
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
type "pubid:bsi:draft-document", "dd", core: ["number"]
|
|
34
34
|
type "pubid:bsi:published-document", "pd", core: ["number"]
|
|
35
35
|
type "pubid:bsi:publicly-available-specification", "pas", core: ["number"]
|
|
36
|
+
type "pubid:bsi:standalone-amendment", "sa", core: ["number"]
|
|
36
37
|
type "pubid:bsi:technical-specification", "ts", core: ["number"]
|
|
37
38
|
end
|
|
38
39
|
end
|
|
@@ -2,10 +2,12 @@ module Pubid
|
|
|
2
2
|
module BsiPfs
|
|
3
3
|
# Human renderer, generated from the canonical template.
|
|
4
4
|
class Renderer < ::Pubid::Renderers::Base
|
|
5
|
-
# The designation faces (the typed trio
|
|
6
|
-
#
|
|
7
|
-
# publisher — the column keeps
|
|
8
|
-
|
|
5
|
+
# The designation faces (the typed trio and the face-only
|
|
6
|
+
# designations): the token that selected the class prints
|
|
7
|
+
# where the face names the publisher — the column keeps
|
|
8
|
+
# the organization default. A face-only type carries no
|
|
9
|
+
# serialized type, so the face reads the class's own short.
|
|
10
|
+
DESIGNATION_FACES = ["PAS", "PD", "DD", "TS", "AMD"].freeze
|
|
9
11
|
|
|
10
12
|
def render(**_opts)
|
|
11
13
|
f = render_fields(@id)
|
|
@@ -47,7 +49,7 @@ module Pubid
|
|
|
47
49
|
run << "+#{member.supplement_notation}"
|
|
48
50
|
end
|
|
49
51
|
view = {
|
|
50
|
-
publisher: (t = root.type&.abbr) && DESIGNATION_FACES.include?(t) ? t : (root.publisher&.respond_to?(:body) ? root.publisher.body : root.publisher),
|
|
52
|
+
publisher: (t = root.type&.abbr || root.class.type[:short]) && DESIGNATION_FACES.include?(t) ? t : (root.publisher&.respond_to?(:body) ? root.publisher.body : root.publisher),
|
|
51
53
|
number: root.number,
|
|
52
54
|
part: root.part,
|
|
53
55
|
year: root.date&.year,
|
data/lib/pubid/bsi_pfs/urn.adoc
CHANGED
|
@@ -12,9 +12,18 @@ the first module-composition proof flavor, `definitions/bsi.pfs` in
|
|
|
12
12
|
pubid-grammar). The composed definition declares the scheme-canonical
|
|
13
13
|
tags with a narrowed atom table (`pub-`, `part-`, `year-`, the adopted
|
|
14
14
|
node and the consolidated `ids`), registered under the `bsi_pfs` flavor
|
|
15
|
-
key. to_pubid_urn emits and round-trips on
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
key. to_pubid_urn emits and round-trips on every absorbed face: the
|
|
16
|
+
plain BS face, the composed consolidated bundles and the PAS
|
|
17
|
+
designation, and the adoption wrappers — the codec composes nested
|
|
18
|
+
nodes root-first along the wrapper's uniform `base` slot (the declared
|
|
19
|
+
`adopted.attribute: base`), so an adoption encodes the origin
|
|
20
|
+
document's chain under the wrapper's type token
|
|
21
|
+
(`BS EN 1073-2:2002` → `urn:pubid:bsi:cencenelec.en:1073:part-2:year-2002:aen`).
|
|
22
|
+
Its literal corpus is the parity harness's absorbed faces
|
|
23
|
+
(`spec/pubid/bsi_pfs/`).
|
|
24
|
+
|
|
25
|
+
The declared schema carries a type row per composed family. The
|
|
26
|
+
standalone-amendment row (pubid-grammar#151, the face-only designation)
|
|
27
|
+
places `sa` over a positional `number` core: `AMD 11015` encodes
|
|
28
|
+
`urn:pubid:bsi:sa:11015`, the same row-driven placement every other
|
|
29
|
+
type uses.
|
data/lib/pubid/bsi_pfs.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
#
|
|
3
3
|
# PFS-generated flavor — DO NOT EDIT BY HAND.
|
|
4
|
-
# Source: definitions/bsi.pfs (pfs:1) sha256:
|
|
5
|
-
# Compiler: pubid/grammar/pfs 0.
|
|
4
|
+
# Source: definitions/bsi.pfs (pfs:1) sha256:e8126cde50a41d8f0e6d8f3ec7e6d2717880637ee2cbce0fdae0ca6b0ee90a8e
|
|
5
|
+
# Compiler: pubid/grammar/pfs 2.0.0 (baked with parsanol 1.5.1.0)
|
|
6
6
|
# Regenerate: ruby scripts/pfs compile definitions/bsi.pfs --as bsi_pfs --ruby-out <dir>
|
|
7
7
|
|
|
8
8
|
require "pubid"
|
data/lib/pubid/calconnect_pfs.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# PFS-generated flavor — DO NOT EDIT BY HAND.
|
|
4
4
|
# Source: definitions/calconnect.pfs (pfs:1) sha256:2e864f0185a1a2f18a392f2f401ad3c9d65d1f32a9ec3f3f04f7dfca9b2226c4
|
|
5
|
-
# Compiler: pubid/grammar/pfs 0.
|
|
5
|
+
# Compiler: pubid/grammar/pfs 2.0.0 (baked with parsanol 1.5.1.0)
|
|
6
6
|
# Regenerate: ruby scripts/pfs compile definitions/calconnect.pfs --as calconnect_pfs --ruby-out <dir>
|
|
7
7
|
|
|
8
8
|
require "pubid"
|
|
@@ -29,6 +29,10 @@ module Pubid
|
|
|
29
29
|
"FprEN" => "fpren",
|
|
30
30
|
}.freeze
|
|
31
31
|
|
|
32
|
+
# The model column the adopted document lands on (the vendored
|
|
33
|
+
# hook's wrapper slot) and the declared edition face, if any.
|
|
34
|
+
ADOPTED_ATTRIBUTE = "adopted"
|
|
35
|
+
|
|
32
36
|
def self.build(parsed_data)
|
|
33
37
|
new.build(parsed_data)
|
|
34
38
|
end
|
|
@@ -27,15 +27,15 @@ module Pubid
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
# The publisher serializes as a bare string, the copublishers
|
|
31
|
+
# as a list of strings (the coded flavor's flat-scalar table).
|
|
32
|
+
def self.flat_scalar_components
|
|
33
|
+
super.merge(publisher: "publisher", copublishers: "copublishers")
|
|
34
|
+
end
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
def self.flat_scalar_fields
|
|
37
|
+
super.merge(publisher: :body, copublishers: :body)
|
|
38
|
+
end
|
|
39
39
|
|
|
40
40
|
# The declared draft stages: the serialized code is the key,
|
|
41
41
|
# the official-URN code the declared `urn:` value.
|
|
@@ -47,9 +47,13 @@ module Pubid
|
|
|
47
47
|
# A draft stage serializes as its typed-stage code
|
|
48
48
|
# ("stage" => "pren"); #inflate_scalar_components rebuilds
|
|
49
49
|
# the three components from it (the coded compact-hash shape).
|
|
50
|
+
# A PUBLISHED trio stays nested: the coded flavors that
|
|
51
|
+
# carry one (the designations) serialize type/stage/
|
|
52
|
+
# typed_stage in full — only a draft stage compacts.
|
|
50
53
|
def self.compact_hash(model, hash)
|
|
51
54
|
stage = model.typed_stage
|
|
52
55
|
return unless stage && hash.key?("typed_stage")
|
|
56
|
+
return if stage.stage_code.to_s == "published"
|
|
53
57
|
return unless model.type == stage.to_type &&
|
|
54
58
|
model.stage == stage.to_stage
|
|
55
59
|
|
|
@@ -17,14 +17,12 @@ module Pubid
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
-
attribute :type, ::Pubid::Components::Type, default: -> { self.class.default_type }
|
|
21
|
-
|
|
22
|
-
def self.default_type
|
|
23
|
-
::Pubid::Components::Type.new(abbr: type[:short])
|
|
24
|
-
end
|
|
25
20
|
|
|
26
21
|
# The adopted document (feature 4): the whole identity lives
|
|
27
|
-
# on the nested ISO/IEC identifier
|
|
22
|
+
# on the nested ISO/IEC identifier, under the declared
|
|
23
|
+
# model column (the uniform `base` renames the wrapper
|
|
24
|
+
# slot — the codec's root-first walk and the from_hash
|
|
25
|
+
# key read it).
|
|
28
26
|
attribute :adopted, ::Pubid::Identifier, polymorphic: true
|
|
29
27
|
|
|
30
28
|
def root
|
|
@@ -17,14 +17,12 @@ module Pubid
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
-
attribute :type, ::Pubid::Components::Type, default: -> { self.class.default_type }
|
|
21
|
-
|
|
22
|
-
def self.default_type
|
|
23
|
-
::Pubid::Components::Type.new(abbr: type[:short])
|
|
24
|
-
end
|
|
25
20
|
|
|
26
21
|
# The adopted document (feature 4): the whole identity lives
|
|
27
|
-
# on the nested ISO/IEC identifier
|
|
22
|
+
# on the nested ISO/IEC identifier, under the declared
|
|
23
|
+
# model column (the uniform `base` renames the wrapper
|
|
24
|
+
# slot — the codec's root-first walk and the from_hash
|
|
25
|
+
# key read it).
|
|
28
26
|
attribute :adopted, ::Pubid::Identifier, polymorphic: true
|
|
29
27
|
|
|
30
28
|
def root
|
data/lib/pubid/cen_pfs.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# PFS-generated flavor — DO NOT EDIT BY HAND.
|
|
4
4
|
# Source: definitions/cen.pfs (pfs:1) sha256:b8f2c00e392dbc03c1fddedad141afa7c930c5430738721b7df0ac69a371d028
|
|
5
|
-
# Compiler: pubid/grammar/pfs 0.
|
|
5
|
+
# Compiler: pubid/grammar/pfs 2.0.0 (baked with parsanol 1.5.1.0)
|
|
6
6
|
# Regenerate: ruby scripts/pfs compile definitions/cen.pfs --as cen_pfs --ruby-out <dir>
|
|
7
7
|
|
|
8
8
|
require "pubid"
|
data/lib/pubid/doi_pfs.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# PFS-generated flavor — DO NOT EDIT BY HAND.
|
|
4
4
|
# Source: definitions/doi.pfs (pfs:1) sha256:60abc3c403c61019d727ee44d9a72591c1549672451e6609a72d36189cae6340
|
|
5
|
-
# Compiler: pubid/grammar/pfs 0.
|
|
5
|
+
# Compiler: pubid/grammar/pfs 2.0.0 (baked with parsanol 1.5.1.0)
|
|
6
6
|
# Regenerate: ruby scripts/pfs compile definitions/doi.pfs --as doi_pfs --ruby-out <dir>
|
|
7
7
|
|
|
8
8
|
require "pubid"
|
data/lib/pubid/etsi/CLAUDE.md
CHANGED
|
@@ -41,3 +41,21 @@ is `:int` (`core: [["number", :int]]`), and the codec refuses a String there.
|
|
|
41
41
|
`minor` and `day` are placed although no pass fixture sets them, because
|
|
42
42
|
`EtsiStandard`'s `key_value` block maps them: a schema must place every key
|
|
43
43
|
the mapping can write, not only the keys the corpus shows.
|
|
44
|
+
|
|
45
|
+
## Official URN: the month 08/09 octal trap (repaired)
|
|
46
|
+
|
|
47
|
+
`UrnGenerator#urn_date` fed the zero-padded `month` **string** to
|
|
48
|
+
`format('%02d', …)`, and `%d` reads its argument through `Integer()` — which
|
|
49
|
+
refuses `"08"`/`"09"` as octal look-alikes. So every corpus row dated
|
|
50
|
+
`(YYYY-08)`/`(YYYY-09)` parsed and rendered fine but **`to_urn` raised
|
|
51
|
+
`ArgumentError`** — the three-engine differential reported these rows as
|
|
52
|
+
"ruby rejects" against rust/ts (which render
|
|
53
|
+
`urn:etsi:<type>:<code>:<version>:<yyyy>-<mm>` for every month). The fix is
|
|
54
|
+
`date.month.to_i` before the format (decimal cast); the etsi_pfs parity spec
|
|
55
|
+
had pinned the raise as a known defect and the pin flipped with the fix
|
|
56
|
+
(`spec/pubid/etsi_pfs/parity_spec.rb`, "official URN segments"). Locked by
|
|
57
|
+
`spec/pubid/etsi/urn_spec.rb`. The testsuite corpus rows for those months
|
|
58
|
+
carry no `urn:` representation precisely because the generator crashed when
|
|
59
|
+
the corpus round exported them — a future etsi corpus round can now emit
|
|
60
|
+
them. (hand-off: etsi-differential-rows.)
|
|
61
|
+
|
|
@@ -32,7 +32,10 @@ module Pubid
|
|
|
32
32
|
|
|
33
33
|
date = identifier.date
|
|
34
34
|
if date.month
|
|
35
|
-
|
|
35
|
+
# `month` is a zero-padded string ("09"); `%d` reads it through
|
|
36
|
+
# Integer(), which refuses "08"/"09" as octal look-alikes —
|
|
37
|
+
# cast to a decimal integer first.
|
|
38
|
+
"#{date.year}-#{format('%02d', date.month.to_i)}"
|
|
36
39
|
else
|
|
37
40
|
date.year.to_s
|
|
38
41
|
end
|
data/lib/pubid/etsi_pfs.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# PFS-generated flavor — DO NOT EDIT BY HAND.
|
|
4
4
|
# Source: definitions/etsi.pfs (pfs:1) sha256:490ba9435f44dbd2d59429ae6d9527909c39444f19fec5a33a8cad91e89e3581
|
|
5
|
-
# Compiler: pubid/grammar/pfs 0.
|
|
5
|
+
# Compiler: pubid/grammar/pfs 2.0.0 (baked with parsanol 1.5.1.0)
|
|
6
6
|
# Regenerate: ruby scripts/pfs compile definitions/etsi.pfs --as etsi_pfs --ruby-out <dir>
|
|
7
7
|
|
|
8
8
|
require "pubid"
|
data/lib/pubid/iala/urn.adoc
CHANGED
data/lib/pubid/iec/CLAUDE.md
CHANGED
|
@@ -53,6 +53,8 @@ These notes were part of the root `CLAUDE.md`. Read them before you change `lib/
|
|
|
53
53
|
|
|
54
54
|
- **The TR/TS/PAS point stages carry the correspondence table's own codes (issue #733).** The registry contradicted the SSOT it cites: the `:cdpas` row was a **fabricated** committee-draft state (stage_code `:cd`, harmonized leading 30.xx) with no row in the table, while the `:dpas` row's abbr list still folded `"CDPAS"` beside a comment admitting CDPAS is the 50.20 row; and the TR/TS ladders folded the point spellings onto the 50.00 ladder rows (`:dtr` `abbr: %w[DTR ADTR CDTR DTRM NDTR DTSM DTRM]` — DTRM listed **twice**), so every spelling emitted `tr-stage-50.00`/`ts-stage-50.00` and `IEC DTSM 60038` (a DTS stage!) decoded as a TechnicalReport because only the TR row claimed the token. The ruling: the IEC/ISO Harmonized APIs stage-code table (section 3 "IEC/ISO Stage Code correspondance", identical in v0.0.7 2021-05 and v0.0.8 2023-06; the extract is `data/iec/stage-codes.md`) is correct, the gem was wrong. The fix wires the per-spelling data that was already sitting in each file's `PROJECT_STAGES` hash into `TypedStage.new` rows: **CDPAS** 50.20 ("Draft circulated as DPAS", stage_code `:draft` — the fabricated 30.xx row deleted, the duplicate fold removed), **ADTR** 40.99 / **CDTR** 50.20 / **NDTR** 50.92 / **DTRM** 50.92 (TR), **ADTS** 40.99 / **CDTS** 50.20 / **NDTS** 50.92 / **DTSM** 50.92 (TS); plain **DTR/DTS** keep the folded 50.00 ladder (the registration step) and **DPAS** is untouched. Row order follows the correspondence table, which makes the official-URN reverse lookup (`urn_parser.rb#type_slot_to_code`, first row matching `(type_code, harmonized_stages.first)`) resolve the shared 50.92 slot to **DTRM/DTSM** — NDTR and DTRM (NDTS and DTSM) share the slot because the TABLE gives both spellings the same code; the official URN is the harmonized code and is honestly lossy there, while the pubid-scheme URN (`stage-ndtr` vs `stage-dtrm`) keeps the pair distinct. `pnw_stage_spec.rb`'s uniqueness tripwire gained an `ALLOWED_COLLISIONS` allow-list for exactly those two pairs — any other (type, leading-code) collision still fails. **Render keeps the parsed spelling per row** (`abbr.first` of its own row), the #191/#193 pattern — the old fold-to-DTR/DTS render was a consequence of the fold, not a separate normalization. **The grammar needed NO extension and NO rebake**: all nine tokens were already in `tables/iec_typed_stages.yaml` (the table only lists acceptable tokens; the token→row decode is the builder's `locate_stage`), so `data/parg/iec.json` is byte-identical. `from_hash` residue: stored hashes carry the stage CODE (`"stage" => "dtr"`), so pre-#733 stored rows deserialize to the ladder row they always named — no index migration. **Measured by the replay gate**: over all 12,488 full-fixture inputs, `to_s`/`to_urn`/`to_pubid_urn`/`to_mr_string`/`to_hash`/class/`root.number` are byte-identical to the 2.0.34 baseline — 0 diffs (zero attested rows carry any of the spellings; verified in the gem fixtures and the testsuite ledger `tests/iec/*.yaml`). Locked by `spec/pubid/iec/stage_point_codes_spec.rb` (every probe row: class, render, official-URN slot, pubid URN + round trip; the shared-slot pins; plain DTR/DTS/DPAS byte-identical; the abbr-list unfolds; the #570 harmonized-code lookups unchanged). (hand-off: iec-stage-point-codes.)
|
|
55
55
|
|
|
56
|
+
- **The consolidated chains get their algebra and their slugs (issue #788).** The parse/render surface was already at catalogue parity — every attested shape parses, renders byte-exact and emits the published `urn:iec:std:` value (verified against the 2,031 `+AMD`-bearing records of `relaton-data-iec`; the CSV face rides `VapIdentifier(base=ConsolidatedIdentifier(…), vap: ["CSV"])`, the `CSV/COR` face a `Corrigendum` around the Vap). What the flavor lacked was the composition's ALGEBRA and SLUG, both now landed. **(1) `ConsolidatedIdentifier#drop_supplements`** — the peel the CEN counterpart has had all along: the chain reduces to `identifiers&.first`, which turns on `exclude(:amendment)`/`exclude(:supplement)` and their `matches?(ignore:)` forms — a consolidated docid now resolves onto the bare base record, the primitive relaton-api-js's citation-validation (their #178) resolves a consolidated key with. **(2) The wrapper MR slugs** — the generic flat renderer read the wrapper's delegated `number` and never the wrapped part, so `IEC 60601-1:2005+AMD1:2012 CSV` keyed `iec.60601.2005`: the part dropped (two DIFFERENT documents — part 1 and part 2 of IEC 60601, both consolidated — shared one slug, the #142 defect verbatim one layer down), every chain member but the last suffix was invisible, and the slug collided with the bare base document and the bare consolidated chain alike. The fix composes: `ConsolidatedIdentifier#to_mr_string` renders the base member (part riding on the member) and appends each supplement member behind a `plus-` marker (`iec.60601-1.2005_plus-amd.1.2012_plus-cor.1.2012`, the CEN shape verbatim); `VapIdentifier#to_mr_string` appends the deliverable codes (`…_csv`, multi-code faces join with `-`); and `SupplementIdentifier#to_mr_string` routes its chain HEAD through `base.to_mr_string` instead of the generic renderer recursion — the renderer renders the wrapped document flat and bypassed a wrapper class's own composition, so `CSV/COR1:2014` dropped the part and the whole chain (`iec.60335.2010_cor.1.2014`; now `iec.60335-1.2010_plus-amd.1.2013_csv_cor.1.2014`). For every class without an override the base's own path is byte-identical to what the renderer produced, so the standalone `/AMD` chains and every other flavor are untouched — the shared renderer itself is deliberately NOT changed (routing its recursion through `to_mr_string` would have moved NIST/CSA supplement heads fleet-wide; that is a separate, cross-flavor decision). **(3) The un-renderable trailing-edition chain is rejected at parse** — `IEC 60068:2005+AMD1:2012 ED2` parsed (the trailing edition landed on the base member) and then rendered `IEC 60068:2005 ED2+AMD1:2012`, a face the grammar rejects, so `parse(to_s)` raised. No IEC source prints an edition facet on a chain — 0 of the 33,070 primary docidentifiers in `relaton-data-iec`, 0 gem-fixture rows — so the shape is rejected on the BUILT object (`reject_unrenderable_consolidated_edition`, the #727 shape-not-grammar-route ruling; the walk reuses `descend_wrapper`), with `from_hash` left open: parse can no longer produce it and no stored row carries it. The edition-bearing face that DOES round-trip is the CSV one (`IEC 60068:2005+AMD1:2012 CSV ED1` — the edition rides the Vap after the deliverable code). **Measured by the replay gate**: over all 26,861 full-fixture inputs, `to_s`/`to_urn`/`to_hash`/class/parse-status are byte-identical to the pre-change baseline — 0 diffs; `to_mr_string` differs for exactly the 1,999 Vap-rooted rows, every one in the repair direction (part restored, chain visible, deliverable carried). No ledger pins MR strings, so no corpus move follows; the URN doc (`urn.adoc`) gained the `consol` example row and the #788 note. Locked by `spec/pubid/iec/consolidated_chain_spec.rb` (the attested-row matrix with the PUBLISHED official URNs, the typed composition, the drop_supplements/matches algebra, the MR table + collision cases also added to `spec/pubid/mr_string_spec.rb`, the trailing-edition reject with input/flavor shape, the malformed-chain rejects) and by `spec/pubid/iec/consolidated_peel_spec.rb` (unchanged). **Grammar: no change, no rebake** — the `consolidated_supplement` rule already mirrored the chain forms, and the rejects are shape checks. (hand-off: iec-consolidated-parity.)
|
|
57
|
+
|
|
56
58
|
## pubid-scheme URN (issue #670; gaps closed by #687)
|
|
57
59
|
|
|
58
60
|
`lib/pubid/iec/pubid_urn_schema.rb` completes the partial schema the IEEE
|
|
@@ -65,3 +67,5 @@ gaps the wave inherited are closed (#687, atoms `tc-`/`wdlang-`/`wdstage-`/
|
|
|
65
67
|
WorkingDocument URNs per document instead of the shared type-only
|
|
66
68
|
`urn:pubid:iec:wd`, and a TestReportForm's CISPR document nests under
|
|
67
69
|
`cispr-`. All landed URNs are unchanged.
|
|
70
|
+
|
|
71
|
+
- **The official-URN stage slot follows the correspondence table's CD code (issue #787 — the pubid-ts#187 parity round closed).** The TS mirror's pubid#727-era finding ("URN stage-slot gaps, stage-30.20/50.00/dcor/dish", pubid-ts PR #186 verification notes → issue pubid-ts#187) listed four official-`urn:iec:std:` stage slots where the two engines minted different URNs. The issue text (#787) inverted the direction for three of the four. Measured verdict, side by side: **`dcor`/`dish` and `50.00` were TS-side gaps, already closed mirror-side** — the mirror's `stageToken` now follows the gem ("no stage-code fallback … leaves the slot empty (#187)", `pubid-ts/src/flavors/iec/index.ts`), and the corpus ATTESTS the empty slot for the draft-supplement identities (`tests/iec/corrigendum.yaml`: `urn:iec:std:iec:60038-1::::::cor:1:` for the CDCOR row; `tests/iec/interpretation_sheet.yaml`: `…::::::ish:1:` for DISH) — the slot reads the ROOT document (`stage_or_type_slot(doc)`), so a supplement-layer stage never reaches it, and IEC's table names no DCOR row at all. **`30.20` was the one gem-side gap**: the IS/TR/TS committee-draft rows led their harmonized lists with 30.00 — a code in NO row of `data/iec/stage-codes.md` — while the table's CD row is `30.20 | CD | Draft circulated as CD | IS, TR, TS` and the mirror (before its #187 alignment) emitted exactly that. The fix is a LEAD REORDER, not a #733 row split: `harmonized_stages` on the `:cd`/`:cd_tr`/`:cd_ts` rows now lead 30.20 with the rest of the 30.xx ladder behind them, so the folded range honor form is unchanged (no reclassification in `stage_codes_ssot_spec.rb`), no `code:` moves (a split would have colliding `:cd` codes and broken `stage_from_kv`'s first-match resolution for the folded faces), no `to_hash`/pubid-URN movement, and `locate_stage_by_harmonized_code` (membership-based, the #570 rule) is unaffected. `IEC CD 60038` → `urn:iec:std:iec:60038::stage-30.20::`, and the reverse lookup `(is, 30.20)` resolves the `:cd` row so `parse_urn` round-trips exactly. **No attested row moves**: the relaton-data-iec corpus carries no `stage-*` value in any slot (S7 holds only `tr`/`ts`/`pas`/`guide`/`srd`), the testsuite ledgers' only stage-bearing rows are the work-programme `stage-00.00`/`stage-10.20` ones, and no gem fixture carries a CD-family face — the only pins that moved are the synthetic shapes in `spec/pubid/iec/urn_stage_edition_spec.rb` (CD, CD TR, and their `parse_urn` round trips), which now also pin the attested empty slot for the DCOR/DISH/FDAM faces. Mirror-side residue: `pubid-ts/src/flavors/iec/model.ts` hand-copies the leads (`TS("cd", …, "30.00")`, `cd_tr`, `cd_ts`) and needs the same three-value flip to restore byte parity. (hand-off: iec-urn-stage-slots.)
|
data/lib/pubid/iec/identifier.rb
CHANGED
|
@@ -277,6 +277,7 @@ module Pubid
|
|
|
277
277
|
id.ensure_base if id.is_a?(SupplementIdentifier)
|
|
278
278
|
reject_standalone_dotted_supplement(id, string)
|
|
279
279
|
reject_unrenderable_fragment(id, string)
|
|
280
|
+
reject_unrenderable_consolidated_edition(id, string)
|
|
280
281
|
id
|
|
281
282
|
end
|
|
282
283
|
|
|
@@ -387,6 +388,60 @@ module Pubid
|
|
|
387
388
|
end
|
|
388
389
|
end
|
|
389
390
|
|
|
391
|
+
# The bare consolidated chain with a trailing edition
|
|
392
|
+
# ("IEC 60068:2005+AMD1:2012 ED2") parses, and then cannot render:
|
|
393
|
+
# the edition rides the base member, so the composition prints it
|
|
394
|
+
# onto the base designation ("IEC 60068:2005 ED2+AMD1:2012") — a face
|
|
395
|
+
# no IEC source prints and the grammar rejects, so parse(to_s)
|
|
396
|
+
# raises. The attested consolidated editions carry no edition facet
|
|
397
|
+
# on the chain at all (0 of the 33,070 primary docidentifiers in
|
|
398
|
+
# relaton-data-iec; 0 rows in the gem fixtures): the consolidated
|
|
399
|
+
# edition IS the CSV product ("IEC 60034-18-41:2014+AMD1:2019 CSV",
|
|
400
|
+
# the OBP PDF named `{ed1.1}`), and where the printed edition
|
|
401
|
+
# appears at all it is the CSV face's own facet
|
|
402
|
+
# ("IEC 60068:2005+AMD1:2012 CSV ED1" — the Vap carries the edition
|
|
403
|
+
# after the deliverable code and renders back parseably). So the
|
|
404
|
+
# shape is rejected at parse — the #727 ruling for unattested,
|
|
405
|
+
# un-renderable faces — rather than built unrenderable. The check is
|
|
406
|
+
# the SHAPE on the built object, not a grammar route (the same
|
|
407
|
+
# ruling as reject_standalone_dotted_supplement): a bare
|
|
408
|
+
# ConsolidatedIdentifier with an edition on any member. from_hash
|
|
409
|
+
# stays open (stored-data compatibility): parse can no longer
|
|
410
|
+
# produce the shape, and no stored row carries it.
|
|
411
|
+
CONSOLIDATED_EDITION_MESSAGE =
|
|
412
|
+
"the bare consolidated chain carries a trailing edition " \
|
|
413
|
+
"(e.g. \"IEC 60068:2005+AMD1:2012 ED2\"): no IEC source prints " \
|
|
414
|
+
"one — 0 of the 33,070 primary docidentifiers in relaton-data-iec " \
|
|
415
|
+
"carry an edition facet on a chain — and the canonical render " \
|
|
416
|
+
"prints the edition onto the base designation " \
|
|
417
|
+
"(\"IEC 60068:2005 ED2+AMD1:2012\"), which cannot be re-parsed. " \
|
|
418
|
+
"The consolidated edition is the CSV face (\"IEC " \
|
|
419
|
+
"60034-18-41:2014+AMD1:2019 CSV\", the OBP PDF named {ed1.1}); " \
|
|
420
|
+
"where the printed edition appears it rides the CSV face " \
|
|
421
|
+
"(\"IEC 60068:2005+AMD1:2012 CSV ED1\"), which parses and " \
|
|
422
|
+
"round-trips"
|
|
423
|
+
|
|
424
|
+
def self.reject_unrenderable_consolidated_edition(id, input)
|
|
425
|
+
node = id
|
|
426
|
+
while node
|
|
427
|
+
reject_consolidated_edition_shape(node, input)
|
|
428
|
+
node = descend_wrapper(node)
|
|
429
|
+
end
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
# The rejected edition shape: a bare ConsolidatedIdentifier with an
|
|
433
|
+
# edition on any member. A leaf or a wrapper whose edition rides its
|
|
434
|
+
# own render face (the Vap's `CSV ED1`) passes.
|
|
435
|
+
def self.reject_consolidated_edition_shape(node, input)
|
|
436
|
+
return unless node.is_a?(Identifiers::ConsolidatedIdentifier)
|
|
437
|
+
return unless Array(node.identifiers).any? { |m| !m.edition.nil? }
|
|
438
|
+
|
|
439
|
+
raise Pubid::Errors::ParseError.new(
|
|
440
|
+
CONSOLIDATED_EDITION_MESSAGE, nil,
|
|
441
|
+
input: input, flavor: "iec"
|
|
442
|
+
)
|
|
443
|
+
end
|
|
444
|
+
|
|
390
445
|
# from_hash is the shared polymorphic dispatch on Pubid::Identifier.
|
|
391
446
|
# IEC_TYPE_MAP remains as the key_value polymorphic_map.
|
|
392
447
|
end
|
|
@@ -82,6 +82,41 @@ module Pubid
|
|
|
82
82
|
def supplements
|
|
83
83
|
identifiers&.drop(1) || []
|
|
84
84
|
end
|
|
85
|
+
|
|
86
|
+
# Dropping the supplement layer yields the leading member — the base
|
|
87
|
+
# standard alone (the CEN counterpart's shape). This is what makes
|
|
88
|
+
# the structural exclusions reach a consolidated chain:
|
|
89
|
+
# `exclude(:amendment)` / `exclude(:supplement)` and their
|
|
90
|
+
# `matches?(ignore:)` forms peel the composition to the document it
|
|
91
|
+
# supplements, so a consolidated reference matches the bare base
|
|
92
|
+
# record (the primitive relaton-api-js's citation-validation uses to
|
|
93
|
+
# resolve a consolidated docid onto the edition it amends).
|
|
94
|
+
def drop_supplements
|
|
95
|
+
identifiers&.first || self
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# MR string: the base member's own MR (its part/subpart ride on the
|
|
99
|
+
# member, so the slug keeps the full designation), then each
|
|
100
|
+
# supplement member behind a `plus-` marker — the CEN counterpart's
|
|
101
|
+
# composition. Without it the chain rendered the generic flat slug,
|
|
102
|
+
# which both dropped the part and shared one slug with the bare base
|
|
103
|
+
# document (`IEC 60601-1:2005+AMD1:2012 CSV` keyed `iec.60601.2005`,
|
|
104
|
+
# colliding with the part-less rendering of `IEC 60601-2:2005+AMD1:
|
|
105
|
+
# 2012 CSV` and with the base itself). The `plus-` marker keeps the
|
|
106
|
+
# consolidated slug distinct from the standalone supplement chain's
|
|
107
|
+
# (`iec.60601-1.2005_amd.1.2012`), mirroring the CEN ruling that a
|
|
108
|
+
# consolidated form must not share a slug with the document it
|
|
109
|
+
# composes.
|
|
110
|
+
def to_mr_string
|
|
111
|
+
base, *supplements = identifiers
|
|
112
|
+
return "" unless base
|
|
113
|
+
|
|
114
|
+
([base.to_mr_string] +
|
|
115
|
+
supplements.filter_map do |member|
|
|
116
|
+
suffix = member.mr_supplement_suffix
|
|
117
|
+
"plus-#{suffix}" if suffix
|
|
118
|
+
end).join(Pubid::Renderers::MrString::SEPARATOR_SUPPLEMENT)
|
|
119
|
+
end
|
|
85
120
|
end
|
|
86
121
|
end
|
|
87
122
|
end
|
|
@@ -65,7 +65,13 @@ module Pubid
|
|
|
65
65
|
ACD A2CD A3CD A4CD A5CD A6CD A7CD A8CD A9CD
|
|
66
66
|
CDM PCC SPLIT MERGED],
|
|
67
67
|
name: "Committee Draft",
|
|
68
|
-
|
|
68
|
+
# The lead is the table's own CD code (30.20 "Draft circulated
|
|
69
|
+
# as CD", data/iec/stage-codes.md) — what the official
|
|
70
|
+
# `urn:iec:std:` stage slot carries (pubid#787, the
|
|
71
|
+
# pubid-ts#187 parity round). 30.00 is IEC-unsourced and sits
|
|
72
|
+
# in no row of the table; the rest of the 30.xx ladder stays
|
|
73
|
+
# behind it, so the folded range honor form is unchanged.
|
|
74
|
+
harmonized_stages: %w[30.20 30.00 30.60 30.92 30.96 30.97 30.98
|
|
69
75
|
30.99],
|
|
70
76
|
),
|
|
71
77
|
Pubid::Components::TypedStage.new(
|