pubid 2.0.47 → 2.0.48

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38deff0638245cbb818efee3e1c84d2609c2345f723481911b97f41f38ff75b7
4
- data.tar.gz: '00387514abeb057d531de9ca92e0bfa33f56ea012178ece3681292dc50d7eeec'
3
+ metadata.gz: 14cacbfe26bb38df44afa230ee01ae45d89ca1b4c2fcf70f8673ba140d39fa4c
4
+ data.tar.gz: 2a88cd958a39b727212ed14d96fd16e9ce5f21d8becaa500a9886bdb1b97be26
5
5
  SHA512:
6
- metadata.gz: af5fa6dbdde25dc2e8a4abcccaa6f55cb6c0385c63847b3feb0b6abc294c9a1a2db3c02f10685e7253f3c0b2877458e9fba9af2dd7508684ab40655e649f3357
7
- data.tar.gz: c62f2206a43eb445f543e4528695a27fdd2639362eff38576691ff94698ac66064288f324aa110ae9d14fff22151c16afe5515ed46a7e69bd5a7a29af7815667
6
+ metadata.gz: 12f927b0cc58ebb883eab5e023500b5d05e3505565132b9d4bf745aaf6568de2c8d8152ec01db2ea805ce17209ec57201570f34955cd3d1101032e6b1ca088ae
7
+ data.tar.gz: b56b3746bb0e142b467803458a3821a798b276d419369844fbef66ddab9d0efd08028d443645fff1e7683d26fb5ff68611c5816d72b9336cf5b32d0d90bcfb2b
data/data/parg/ansi.json CHANGED
@@ -1 +1 @@
1
- {"bindings":null,"version":"0.1.0","grammar":"PubidAnsi","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":84}},{"Str":{"pattern":"ANSI"}},{"Named":{"name":"publisher","atom":1}},{"Entity":{"atom":17}},{"Entity":{"atom":15}},{"Str":{"pattern":"/"}},{"Str":{"pattern":" "}},{"Repetition":{"atom":6,"min":0,"max":1,"tag":"Maybe"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Alternative":{"atoms":[9,10]}},{"Repetition":{"atom":11,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[8,12]}},{"Named":{"name":"copublisher","atom":13}},{"Sequence":{"atoms":[5,7,14]}},{"Repetition":{"atom":4,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"copublishers","atom":16}},{"Str":{"pattern":" "}},{"Str":{"pattern":"Std "}},{"Repetition":{"atom":19,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":57}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":22,"min":1,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":24,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":27,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[26,28]}},{"Repetition":{"atom":29,"min":0,"max":3,"tag":"Repetition"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":31,"min":0,"max":1,"tag":"Repetition"}},{"Repetition":{"atom":32,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"-"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":35,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[34,36]}},{"Repetition":{"atom":37,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[23,25,30,33,38]}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":40,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":43,"min":1,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Repetition":{"atom":45,"min":0,"max":1,"tag":"Repetition"}},{"Repetition":{"atom":46,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[42,44,47]}},{"Repetition":{"atom":48,"min":0,"max":2,"tag":"Repetition"}},{"Str":{"pattern":"-"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":51,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[50,52]}},{"Repetition":{"atom":53,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[41,49,54]}},{"Alternative":{"atoms":[39,55]}},{"Named":{"name":"number_with_part","atom":56}},{"Entity":{"atom":69}},{"Str":{"pattern":":"}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[60,61]}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":63,"min":2,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Lookahead":{"atom":65,"positive":false}},{"Sequence":{"atoms":[62,64,66]}},{"Named":{"name":"date","atom":67}},{"Sequence":{"atoms":[59,68]}},{"Repetition":{"atom":58,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":82}},{"Str":{"pattern":"("}},{"Entity":{"atom":80}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Repetition":{"atom":74,"min":2,"max":null,"tag":"Repetition"}},{"Str":{"pattern":","}},{"Repetition":{"atom":76,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[75,77]}},{"Repetition":{"atom":78,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"languages","atom":79}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[72,73,81]}},{"Repetition":{"atom":71,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[2,3,18,20,21,70,83]}},{"Entity":{"atom":96}},{"Str":{"pattern":"ANSI"}},{"Named":{"name":"publisher","atom":86}},{"Str":{"pattern":" "}},{"Str":{"pattern":"Std "}},{"Repetition":{"atom":89,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":57}},{"Entity":{"atom":69}},{"Repetition":{"atom":92,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":82}},{"Repetition":{"atom":94,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[87,88,90,91,93,95]}},{"Alternative":{"atoms":[0,85]}}],"root":97},"bindings":[{"capture":"publisher","path":"publisher","type":"string","card":null,"preprocess":null},{"capture":"copublisher","path":"copublishers[].copublisher","type":"string","card":null,"preprocess":null},{"capture":"number_with_part","path":"number_with_part","type":"string","card":null,"preprocess":null},{"capture":"date","path":"date","type":"string","card":null,"preprocess":null},{"capture":"languages","path":"languages","type":"string","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":"ANSI C63.4","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/IEEE C63.4","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI Std A119.1","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI X9.62-2005","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/UL 94-2023","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/NISO Z39.88-2004","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/ASHRAE/IES 90.1-2019","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/AAMI ST79:2017","expect":{}},{"entry":"identifier","kind":"reject","input":"ANSI/ul 94-2023","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}}],"docs":{},"source":"# Port of lib/pubid/ansi/parser.rb: ANSI [copublishers] [Std] number\n# [:year][(languages)]. The number alternatives cover letter-prefixed\n# forms (C37.06.1, N323A) and plain dotted forms (802.1b-1995).\n#\n# Edition-2 notes: letter_head_part / plain_part / year_digits bodies are\n# inlined at the capture sites (a capture wrapping a rule ref expands to\n# element hashes, while the inlined body binds as one scalar string).\n# The copublishers wrapper stays a capture so the tree keeps the\n# {copublishers: [...]} shape the builder reads; the repeats collect by\n# occurrence under copublishers[].copublisher.\n\ngrammar PubidAnsi version \"0.1.0\" edition 2 {\n # Any uppercase developer acronym co-publishes (relaton#45): ASHRAE,\n # UL, NISO, INCITS, HL7, ASC ... An uppercase letter, then uppercase\n # letters or digits. The copublisher body is inlined to raw terms: bare\n # rule refs next to a capture drop the capture or materialize stray\n # {slash:} nodes.\n copublisher_item = \"/\" [\" \"] ( %x41-5A 1*(%x41-5A / %x30-39) ) as copublisher\n copublishers = ( 1*copublisher_item ) as copublishers\n std_keyword = [\"Std \"]\n number_with_part = {\n (\n ( 1*(%x41-5A) 1*(%x30-39) *3(\".\" 1*(%x30-39)) [*1(%x41-5A)] [(\"-\" 1*(%x30-39))] )\n / ( 1*(%x30-39) *2(\".\" 1*(%x30-39) [*1(%x61-7A)]) [(\"-\" 1*(%x30-39))] )\n ) as number_with_part\n }\n date = \":\" ( (\"19\" / \"20\") 2*(%x30-39) !(%x30-39) ) as date\n languages = ( *( 2*(%x61-7A) [\",\"] ) ) as languages\n language = \"(\" languages \")\"\n identifier_with_copublishers = {\n \"ANSI\" as publisher copublishers \" \" [\"Std \"] number_with_part [date] [language]\n }\n identifier_sole = {\n \"ANSI\" as publisher \" \" [\"Std \"] number_with_part [date] [language]\n }\n identifier = identifier_with_copublishers / identifier_sole\n upper = %x41-5A\n lower = %x61-7A\n digit = %x30-39\n dot = \".\"\n dash = \"-\"\n colon = \":\"\n slash = \"/\"\n space = \" \"\n entry identifier: identifier\n\n bindings identifier {\n publisher -> publisher (string)\n copublisher -> copublishers[].copublisher (string)\n number_with_part -> number_with_part (string)\n date -> date (string)\n languages -> languages (string)\n }\n\n test {\n accept \"ANSI C63.4\"\n accept \"ANSI/IEEE C63.4\"\n accept \"ANSI Std A119.1\"\n accept \"ANSI X9.62-2005\"\n accept \"ANSI/UL 94-2023\"\n accept \"ANSI/NISO Z39.88-2004\"\n accept \"ANSI/ASHRAE/IES 90.1-2019\"\n accept \"ANSI/AAMI ST79:2017\"\n reject \"ANSI/ul 94-2023\"\n reject \"nonsense\"\n }\n}\n","source_hash":"9a6a813325d5e5898758f9038be5cc0d34b4e4078f55f96b8e63e2e53a6dfc11","unicode_tables":"onigmo (Ruby 3.4.10)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:a592ed0b5dda81c93fcf98c9c3e6520ce56dfb93983312ca02452850693d0cf4","checksum":"sha256:fa2c1388465ee69b9752907ba358a9f6c8f909e06f2415dca4c78133a44f508b","validated":{"lint_errors":0,"lint_warnings":1,"tests_total":10,"tests_failures":0,"self_test":true},"byte_checksum":"sha256:42f854707e693e3e0f880a35c070d16448e7ed1f51665c6dc552e79bd23a0e49"}
1
+ {"bindings":null,"version":"0.1.0","grammar":"PubidAnsi","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":121}},{"Str":{"pattern":"ANSI"}},{"Named":{"name":"publisher","atom":1}},{"Entity":{"atom":17}},{"Entity":{"atom":15}},{"Str":{"pattern":"/"}},{"Str":{"pattern":" "}},{"Repetition":{"atom":6,"min":0,"max":1,"tag":"Maybe"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Alternative":{"atoms":[9,10]}},{"Repetition":{"atom":11,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[8,12]}},{"Named":{"name":"copublisher","atom":13}},{"Sequence":{"atoms":[5,7,14]}},{"Repetition":{"atom":4,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"copublishers","atom":16}},{"Str":{"pattern":" "}},{"Str":{"pattern":"-"}},{"Named":{"name":"number_separator","atom":19}},{"Alternative":{"atoms":[18,20]}},{"Str":{"pattern":"Std "}},{"Repetition":{"atom":22,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":84}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":25,"min":1,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":27,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":30,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[29,31]}},{"Repetition":{"atom":32,"min":0,"max":3,"tag":"Repetition"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":34,"min":0,"max":1,"tag":"Repetition"}},{"Repetition":{"atom":35,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"-"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":38,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[37,39]}},{"Repetition":{"atom":40,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"-"}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[43,44]}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":46,"min":2,"max":2,"tag":"Repetition"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Str":{"pattern":":"}},{"Alternative":{"atoms":[48,49]}},{"Lookahead":{"atom":50,"positive":false}},{"Sequence":{"atoms":[42,45,47,51]}},{"Repetition":{"atom":52,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[26,28,33,36,41,53]}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":55,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":58,"min":1,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Repetition":{"atom":60,"min":0,"max":1,"tag":"Repetition"}},{"Repetition":{"atom":61,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[57,59,62]}},{"Repetition":{"atom":63,"min":0,"max":2,"tag":"Repetition"}},{"Str":{"pattern":"-"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":66,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[65,67]}},{"Repetition":{"atom":68,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"-"}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[71,72]}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":74,"min":2,"max":2,"tag":"Repetition"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Str":{"pattern":":"}},{"Alternative":{"atoms":[76,77]}},{"Lookahead":{"atom":78,"positive":false}},{"Sequence":{"atoms":[70,73,75,79]}},{"Repetition":{"atom":80,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[56,64,69,81]}},{"Alternative":{"atoms":[54,82]}},{"Named":{"name":"number_with_part","atom":83}},{"Entity":{"atom":93}},{"Str":{"pattern":"-"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Named":{"name":"revision","atom":87}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Alternative":{"atoms":[89,90]}},{"Lookahead":{"atom":91,"positive":false}},{"Sequence":{"atoms":[86,88,92]}},{"Repetition":{"atom":85,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":106}},{"Str":{"pattern":":"}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[97,98]}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":100,"min":2,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Lookahead":{"atom":102,"positive":false}},{"Sequence":{"atoms":[99,101,103]}},{"Named":{"name":"date","atom":104}},{"Sequence":{"atoms":[96,105]}},{"Repetition":{"atom":95,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":119}},{"Str":{"pattern":"("}},{"Entity":{"atom":117}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Repetition":{"atom":111,"min":2,"max":null,"tag":"Repetition"}},{"Str":{"pattern":","}},{"Repetition":{"atom":113,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[112,114]}},{"Repetition":{"atom":115,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"languages","atom":116}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[109,110,118]}},{"Repetition":{"atom":108,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[2,3,21,23,24,94,107,120]}},{"Entity":{"atom":135}},{"Str":{"pattern":"ANSI"}},{"Named":{"name":"publisher","atom":123}},{"Str":{"pattern":" "}},{"Str":{"pattern":"Std "}},{"Repetition":{"atom":126,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":84}},{"Entity":{"atom":93}},{"Repetition":{"atom":129,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":106}},{"Repetition":{"atom":131,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":119}},{"Repetition":{"atom":133,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[124,125,127,128,130,132,134]}},{"Alternative":{"atoms":[0,122]}}],"root":136},"bindings":[{"capture":"publisher","path":"publisher","type":"string","card":null,"preprocess":null},{"capture":"copublisher","path":"copublishers[].copublisher","type":"string","card":null,"preprocess":null},{"capture":"number_separator","path":"number_separator","type":"string","card":null,"preprocess":null},{"capture":"number_with_part","path":"number_with_part","type":"string","card":null,"preprocess":null},{"capture":"revision","path":"revision","type":"string","card":null,"preprocess":null},{"capture":"date","path":"date","type":"string","card":null,"preprocess":null},{"capture":"languages","path":"languages","type":"string","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":"ANSI C63.4","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/IEEE C63.4","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI Std A119.1","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI X9.62-2005","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/UL 94-2023","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/NISO Z39.88-2004","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/ASHRAE/IES 90.1-2019","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/AAMI ST79:2017","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/ISA-5.1-2009","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/ANS-8.1-2014","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/ISA-61511-1-2018","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI/TIA-568.2-D","expect":{}},{"entry":"identifier","kind":"accept","input":"ANSI X9.8-1-2007","expect":{}},{"entry":"identifier","kind":"reject","input":"ANSI/TIA-568.2-DE","expect":{}},{"entry":"identifier","kind":"reject","input":"ANSI X9.8-1-2007:2009","expect":{}},{"entry":"identifier","kind":"reject","input":"ANSI/ul 94-2023","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}}],"docs":{},"source":"# Port of lib/pubid/ansi/parser.rb: ANSI [copublishers] [Std] number\n# [:year][(languages)]. The number alternatives cover letter-prefixed\n# forms (C37.06.1, N323A) and plain dotted forms (802.1b-1995).\n#\n# Edition-2 notes: letter_head_part / plain_part / year_digits bodies are\n# inlined at the capture sites (a capture wrapping a rule ref expands to\n# element hashes, while the inlined body binds as one scalar string).\n# The copublishers wrapper stays a capture so the tree keeps the\n# {copublishers: [...]} shape the builder reads; the repeats collect by\n# occurrence under copublishers[].copublisher.\n\ngrammar PubidAnsi version \"0.1.0\" edition 2 {\n # Any uppercase developer acronym co-publishes (relaton#45): ASHRAE,\n # UL, NISO, INCITS, HL7, ASC ... An uppercase letter, then uppercase\n # letters or digits. The copublisher body is inlined to raw terms: bare\n # rule refs next to a capture drop the capture or materialize stray\n # {slash:} nodes.\n copublisher_item = \"/\" [\" \"] ( %x41-5A 1*(%x41-5A / %x30-39) ) as copublisher\n copublishers = ( 1*copublisher_item ) as copublishers\n std_keyword = [\"Std \"]\n number_with_part = {\n (\n ( 1*(%x41-5A) 1*(%x30-39) *3(\".\" 1*(%x30-39)) [*1(%x41-5A)] [(\"-\" 1*(%x30-39))] [(\"-\" (\"19\" / \"20\") 2*2(%x30-39) !(%x30-39 / \":\"))] )\n / ( 1*(%x30-39) *2(\".\" 1*(%x30-39) [*1(%x61-7A)]) [(\"-\" 1*(%x30-39))] [(\"-\" (\"19\" / \"20\") 2*2(%x30-39) !(%x30-39 / \":\"))] )\n ) as number_with_part\n }\n # A revision letter after a dash: \"ANSI/TIA-568.2-D\". One uppercase\n # letter, not the start of a word.\n revision = \"-\" ( %x41-5A ) as revision !(%x41-5A / %x30-39)\n date = \":\" ( (\"19\" / \"20\") 2*(%x30-39) !(%x30-39) ) as date\n languages = ( *( 2*(%x61-7A) [\",\"] ) ) as languages\n language = \"(\" languages \")\"\n identifier_with_copublishers = {\n \"ANSI\" as publisher copublishers ( \" \" / ( \"-\" as number_separator ) ) [\"Std \"] number_with_part [revision] [date] [language]\n }\n identifier_sole = {\n \"ANSI\" as publisher \" \" [\"Std \"] number_with_part [revision] [date] [language]\n }\n identifier = identifier_with_copublishers / identifier_sole\n upper = %x41-5A\n lower = %x61-7A\n digit = %x30-39\n dot = \".\"\n dash = \"-\"\n colon = \":\"\n slash = \"/\"\n space = \" \"\n entry identifier: identifier\n\n bindings identifier {\n publisher -> publisher (string)\n copublisher -> copublishers[].copublisher (string)\n number_separator -> number_separator (string)\n number_with_part -> number_with_part (string)\n revision -> revision (string)\n date -> date (string)\n languages -> languages (string)\n }\n\n test {\n accept \"ANSI C63.4\"\n accept \"ANSI/IEEE C63.4\"\n accept \"ANSI Std A119.1\"\n accept \"ANSI X9.62-2005\"\n accept \"ANSI/UL 94-2023\"\n accept \"ANSI/NISO Z39.88-2004\"\n accept \"ANSI/ASHRAE/IES 90.1-2019\"\n accept \"ANSI/AAMI ST79:2017\"\n accept \"ANSI/ISA-5.1-2009\"\n accept \"ANSI/ANS-8.1-2014\"\n accept \"ANSI/ISA-61511-1-2018\"\n accept \"ANSI/TIA-568.2-D\"\n accept \"ANSI X9.8-1-2007\"\n reject \"ANSI/TIA-568.2-DE\"\n reject \"ANSI X9.8-1-2007:2009\"\n reject \"ANSI/ul 94-2023\"\n reject \"nonsense\"\n }\n}\n","source_hash":"7f83a90c91a2f4d44f6f237f6846c459b2f7267bca93dfe4d35d398acc86bac4","unicode_tables":"onigmo (Ruby 3.4.10)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:a06924c35d3c09a9312502da2680f1b4443a6e9ed883b9d65677669c4765f845","checksum":"sha256:413a04b672bf55462edfc6a5113b7327d6d35652f9382402db5da6f8cae964c1","validated":{"lint_errors":0,"lint_warnings":1,"tests_total":17,"tests_failures":0,"self_test":true},"byte_checksum":"sha256:0f3b757b5be0845eda845232fa5e887e987d340876434de8f0acb6a8eb7b39a0"}
@@ -0,0 +1 @@
1
+ {"bindings":null,"version":"0.1.0","grammar":"PubidWmo","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":47}},{"Entity":{"atom":7}},{"Str":{"pattern":"S-"}},{"Entity":{"atom":4}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":3,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"doc_number","atom":5}},{"Sequence":{"atoms":[2,6]}},{"Entity":{"atom":9}},{"Str":{"pattern":" "}},{"Str":{"pattern":"Annex"}},{"Str":{"pattern":"ANNEX"}},{"Alternative":{"atoms":[10,11]}},{"Named":{"name":"annex_marker","atom":12}},{"Entity":{"atom":9}},{"Entity":{"atom":16}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Named":{"name":"annex_letter","atom":15}},{"Entity":{"atom":19}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Lookahead":{"atom":18,"positive":false}},{"Sequence":{"atoms":[14,17,20]}},{"Repetition":{"atom":21,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":37}},{"Entity":{"atom":9}},{"Entity":{"atom":35}},{"Entity":{"atom":4}},{"Repetition":{"atom":26,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":29}},{"Str":{"pattern":"."}},{"Entity":{"atom":4}},{"Repetition":{"atom":30,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[28,31]}},{"Repetition":{"atom":32,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[27,33]}},{"Named":{"name":"edition_value","atom":34}},{"Sequence":{"atoms":[24,25]}},{"Named":{"name":"edition","atom":36}},{"Entity":{"atom":44}},{"Entity":{"atom":40}},{"Str":{"pattern":":"}},{"Str":{"pattern":"ed"}},{"Entity":{"atom":35}},{"Sequence":{"atoms":[39,41,42]}},{"Named":{"name":"edition","atom":43}},{"Alternative":{"atoms":[23,38]}},{"Repetition":{"atom":45,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[1,8,13,22,46]}},{"Entity":{"atom":77}},{"Entity":{"atom":51}},{"Str":{"pattern":"WMO-No."}},{"Named":{"name":"wmomarker","atom":50}},{"Entity":{"atom":9}},{"Entity":{"atom":56}},{"Entity":{"atom":4}},{"Repetition":{"atom":54,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"doc_number","atom":55}},{"Entity":{"atom":68}},{"Entity":{"atom":59}},{"Str":{"pattern":","}},{"Repetition":{"atom":58,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":9}},{"Entity":{"atom":65}},{"Entity":{"atom":4}},{"Repetition":{"atom":63,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"edition_value","atom":64}},{"Str":{"pattern":" edition"}},{"Sequence":{"atoms":[60,61,62,66]}},{"Named":{"name":"edition","atom":67}},{"Entity":{"atom":74}},{"Entity":{"atom":40}},{"Str":{"pattern":"ed"}},{"Entity":{"atom":65}},{"Sequence":{"atoms":[70,71,72]}},{"Named":{"name":"edition","atom":73}},{"Alternative":{"atoms":[57,69]}},{"Repetition":{"atom":75,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[49,52,53,76]}},{"Entity":{"atom":84}},{"Entity":{"atom":7}},{"Entity":{"atom":37}},{"Entity":{"atom":44}},{"Alternative":{"atoms":[80,81]}},{"Repetition":{"atom":82,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[79,83]}},{"Alternative":{"atoms":[0,48,78]}}],"root":85},"bindings":[{"capture":"wmomarker","path":"wmomarker","type":"string","card":null,"preprocess":null},{"capture":"doc_number","path":"doc_number","type":"string","card":null,"preprocess":null},{"capture":"edition_value","path":"edition_value","type":"string","card":null,"preprocess":null},{"capture":"annex_marker","path":"annex_marker","type":"string","card":null,"preprocess":null},{"capture":"annex_letter","path":"annex_letter","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule identifier: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"WMO-No. 1364","expect":{}},{"entry":"identifier","kind":"accept","input":"WMO-No. 1364, 2025 edition","expect":{}},{"entry":"identifier","kind":"accept","input":"WMO-No. 1364 2025 edition","expect":{}},{"entry":"identifier","kind":"accept","input":"WMO-No. 1364:ed2025","expect":{}},{"entry":"identifier","kind":"accept","input":"S-411","expect":{}},{"entry":"identifier","kind":"accept","input":"S-411 1.2.1","expect":{}},{"entry":"identifier","kind":"accept","input":"S-411:ed1.2.1","expect":{}},{"entry":"identifier","kind":"accept","input":"S-411 Annex A","expect":{}},{"entry":"identifier","kind":"accept","input":"S-411 ANNEX A","expect":{}},{"entry":"identifier","kind":"accept","input":"S-411 Annex A 1.2.0","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"WMO-No. edition","expect":{}},{"entry":"identifier","kind":"reject","input":"S-411 1234","expect":{}},{"entry":"identifier","kind":"example","input":"WMO-No. 1364","expect":{"wmomarker":"WMO-No.","doc_number":"1364"}},{"entry":"identifier","kind":"example","input":"WMO-No. 1364, 2025 edition","expect":{"wmomarker":"WMO-No.","doc_number":"1364","edition_value":"2025"}},{"entry":"identifier","kind":"example","input":"S-411 1.2.1","expect":{"doc_number":"411","edition_value":"1.2.1"}},{"entry":"identifier","kind":"example","input":"S-411 Annex A 1.2.0","expect":{"doc_number":"411","annex_marker":"Annex","annex_letter":"A","edition_value":"1.2.0"}},{"entry":"identifier","kind":"example","input":"WMO-No. 1364:ed2025","expect":{"wmomarker":"WMO-No.","doc_number":"1364","edition_value":"2025"}}],"docs":{},"source":"# WMO document identifiers (pubid#763): the WMO-No. publication series\n# and the WMO-published S-100 product specifications.\n#\n# WMO-No. 1364 publication, bare\n# WMO-No. 1364, 2025 edition publication, year edition (citation comma)\n# WMO-No. 1364 2025 edition publication, year edition (cover stack)\n# WMO-No. 1364:ed2025 publication, compact year edition (alias)\n# S-411 S-100 product specification, bare\n# S-411 1.2.1 dotted edition (the S-411 repo form)\n# S-411:ed1.2.1 compact dotted edition (alias)\n# S-411 Annex A annex wrapper (the DCEG docidentifier)\n# S-411 Annex A 1.2.0 annex wrapper carrying its edition\n#\n# Editions are a type-driven face: the WMO-No. series carries calendar-year\n# editions (\"2025 edition\", MRN `ed2025`); the S-100 shapes carry the IHO\n# dotted x.y.z (MRN `ed1.2.1`). Both bind the one `edition_value` capture;\n# the builder keys the face off the resolved type.\n#\n# Type assignment (the #763 ruling): the S-lexical form is a WMO type,\n# publisher-parameterised per IALA's S-201 — the lexical shape is the IHO\n# S-100 form, but the flavor owns the WMO-published documents\n# (metanorma/S-411-Product-Specification, mn-document-class wmo).\n#\n# Edition-2 conversion with typed model bindings, mirroring the iala\n# grammar: each alternative path carries exactly one occurrence of every\n# capture name, so the harvest delivers one flat bound map; the annex base\n# composite stays unbound (its `doc_number` hoists to the top level) and\n# the builder dispatches on `wmomarker` / `annex_marker`. The annex letter\n# guard (!lower) keeps a following edition segment from mis-capturing.\n\ngrammar PubidWmo version \"0.1.0\" edition 2 {\n wmomarker = \"WMO-No.\" as wmomarker\n doc_number = (1*digit) as doc_number\n s_code = \"S-\" (1*digit) as doc_number\n year_value = (4digit) as edition_value\n dotted_value = (1*digit 1*(dot 1*digit)) as edition_value\n edition_year_human = ([comma] space year_value \" edition\") as edition\n edition_year_compact = (colon \"ed\" year_value) as edition\n edition_dotted_human = (space dotted_value) as edition\n edition_dotted_compact = (colon \"ed\" dotted_value) as edition\n annex_identifier = {\n s_code\n space\n (\"Annex\" / \"ANNEX\") as annex_marker\n [ (space upper as annex_letter !lower) ]\n [edition_dotted_human / edition_dotted_compact]\n }\n publication_identifier = {\n wmomarker space doc_number\n [edition_year_human / edition_year_compact]\n }\n standard_identifier = {\n s_code\n [edition_dotted_human / edition_dotted_compact]\n }\n identifier = annex_identifier / publication_identifier / standard_identifier\n entry identifier: identifier\n\n upper = %x41-5A\n lower = %x61-7A\n digit = %x30-39\n comma = \",\"\n colon = \":\"\n dot = \".\"\n space = \" \"\n\n bindings identifier {\n wmomarker -> wmomarker (string)\n doc_number -> doc_number (string)\n edition_value -> edition_value (string)\n annex_marker -> annex_marker (string)\n annex_letter -> annex_letter (string)\n }\n\n test {\n accept \"WMO-No. 1364\"\n accept \"WMO-No. 1364, 2025 edition\"\n accept \"WMO-No. 1364 2025 edition\"\n accept \"WMO-No. 1364:ed2025\"\n accept \"S-411\"\n accept \"S-411 1.2.1\"\n accept \"S-411:ed1.2.1\"\n accept \"S-411 Annex A\"\n accept \"S-411 ANNEX A\"\n accept \"S-411 Annex A 1.2.0\"\n reject \"nonsense\"\n reject \"WMO-No. edition\"\n reject \"S-411 1234\"\n example \"WMO-No. 1364\" { wmomarker: \"WMO-No.\", doc_number: \"1364\" }\n example \"WMO-No. 1364, 2025 edition\" {\n wmomarker: \"WMO-No.\",\n doc_number: \"1364\",\n edition_value: \"2025\",\n }\n example \"S-411 1.2.1\" { doc_number: \"411\", edition_value: \"1.2.1\" }\n example \"S-411 Annex A 1.2.0\" {\n doc_number: \"411\",\n annex_marker: \"Annex\",\n annex_letter: \"A\",\n edition_value: \"1.2.0\",\n }\n example \"WMO-No. 1364:ed2025\" {\n wmomarker: \"WMO-No.\",\n doc_number: \"1364\",\n edition_value: \"2025\",\n }\n }\n}\n","source_hash":"c1154f8f4d15e8e1bb6cf9e72f81ff364f38a4fcdb6a51306ad9168b309e593f","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:b48a1a5ec6cdc049a19e4a5c0384c10c9bf00160cc30924a21606ac45f558819","checksum":"sha256:671bca49cef897f9c5554c6073cf7b9a2319240ecc2a82a36d559af0d44e5d09","validated":{"lint_errors":0,"lint_warnings":1,"tests_total":18,"tests_failures":0,"self_test":true}}
@@ -0,0 +1,108 @@
1
+ # WMO document identifiers (pubid#763): the WMO-No. publication series
2
+ # and the WMO-published S-100 product specifications.
3
+ #
4
+ # WMO-No. 1364 publication, bare
5
+ # WMO-No. 1364, 2025 edition publication, year edition (citation comma)
6
+ # WMO-No. 1364 2025 edition publication, year edition (cover stack)
7
+ # WMO-No. 1364:ed2025 publication, compact year edition (alias)
8
+ # S-411 S-100 product specification, bare
9
+ # S-411 1.2.1 dotted edition (the S-411 repo form)
10
+ # S-411:ed1.2.1 compact dotted edition (alias)
11
+ # S-411 Annex A annex wrapper (the DCEG docidentifier)
12
+ # S-411 Annex A 1.2.0 annex wrapper carrying its edition
13
+ #
14
+ # Editions are a type-driven face: the WMO-No. series carries calendar-year
15
+ # editions ("2025 edition", MRN `ed2025`); the S-100 shapes carry the IHO
16
+ # dotted x.y.z (MRN `ed1.2.1`). Both bind the one `edition_value` capture;
17
+ # the builder keys the face off the resolved type.
18
+ #
19
+ # Type assignment (the #763 ruling): the S-lexical form is a WMO type,
20
+ # publisher-parameterised per IALA's S-201 — the lexical shape is the IHO
21
+ # S-100 form, but the flavor owns the WMO-published documents
22
+ # (metanorma/S-411-Product-Specification, mn-document-class wmo).
23
+ #
24
+ # Edition-2 conversion with typed model bindings, mirroring the iala
25
+ # grammar: each alternative path carries exactly one occurrence of every
26
+ # capture name, so the harvest delivers one flat bound map; the annex base
27
+ # composite stays unbound (its `doc_number` hoists to the top level) and
28
+ # the builder dispatches on `wmomarker` / `annex_marker`. The annex letter
29
+ # guard (!lower) keeps a following edition segment from mis-capturing.
30
+
31
+ grammar PubidWmo version "0.1.0" edition 2 {
32
+ wmomarker = "WMO-No." as wmomarker
33
+ doc_number = (1*digit) as doc_number
34
+ s_code = "S-" (1*digit) as doc_number
35
+ year_value = (4digit) as edition_value
36
+ dotted_value = (1*digit 1*(dot 1*digit)) as edition_value
37
+ edition_year_human = ([comma] space year_value " edition") as edition
38
+ edition_year_compact = (colon "ed" year_value) as edition
39
+ edition_dotted_human = (space dotted_value) as edition
40
+ edition_dotted_compact = (colon "ed" dotted_value) as edition
41
+ annex_identifier = {
42
+ s_code
43
+ space
44
+ ("Annex" / "ANNEX") as annex_marker
45
+ [ (space upper as annex_letter !lower) ]
46
+ [edition_dotted_human / edition_dotted_compact]
47
+ }
48
+ publication_identifier = {
49
+ wmomarker space doc_number
50
+ [edition_year_human / edition_year_compact]
51
+ }
52
+ standard_identifier = {
53
+ s_code
54
+ [edition_dotted_human / edition_dotted_compact]
55
+ }
56
+ identifier = annex_identifier / publication_identifier / standard_identifier
57
+ entry identifier: identifier
58
+
59
+ upper = %x41-5A
60
+ lower = %x61-7A
61
+ digit = %x30-39
62
+ comma = ","
63
+ colon = ":"
64
+ dot = "."
65
+ space = " "
66
+
67
+ bindings identifier {
68
+ wmomarker -> wmomarker (string)
69
+ doc_number -> doc_number (string)
70
+ edition_value -> edition_value (string)
71
+ annex_marker -> annex_marker (string)
72
+ annex_letter -> annex_letter (string)
73
+ }
74
+
75
+ test {
76
+ accept "WMO-No. 1364"
77
+ accept "WMO-No. 1364, 2025 edition"
78
+ accept "WMO-No. 1364 2025 edition"
79
+ accept "WMO-No. 1364:ed2025"
80
+ accept "S-411"
81
+ accept "S-411 1.2.1"
82
+ accept "S-411:ed1.2.1"
83
+ accept "S-411 Annex A"
84
+ accept "S-411 ANNEX A"
85
+ accept "S-411 Annex A 1.2.0"
86
+ reject "nonsense"
87
+ reject "WMO-No. edition"
88
+ reject "S-411 1234"
89
+ example "WMO-No. 1364" { wmomarker: "WMO-No.", doc_number: "1364" }
90
+ example "WMO-No. 1364, 2025 edition" {
91
+ wmomarker: "WMO-No.",
92
+ doc_number: "1364",
93
+ edition_value: "2025",
94
+ }
95
+ example "S-411 1.2.1" { doc_number: "411", edition_value: "1.2.1" }
96
+ example "S-411 Annex A 1.2.0" {
97
+ doc_number: "411",
98
+ annex_marker: "Annex",
99
+ annex_letter: "A",
100
+ edition_value: "1.2.0",
101
+ }
102
+ example "WMO-No. 1364:ed2025" {
103
+ wmomarker: "WMO-No.",
104
+ doc_number: "1364",
105
+ edition_value: "2025",
106
+ }
107
+ }
108
+ }
@@ -26,10 +26,32 @@ key and sends `ANSI/<co-publisher> …` to that co-publisher's flavor
26
26
  adopts it. To rebake: `jq -j .source data/parg/ansi.json > ansi.parg`, edit,
27
27
  `parsanol _1.5.1.0_ parg compile ansi.parg -o data/parg/ansi.json`,
28
28
  `parsanol _1.5.1.0_ parg test data/parg/ansi.json`.
29
- - **Not supported yet: the dash after the acronym** — `ANSI/ISA-5.1-2009`,
30
- `ANSI/ANS-8.1-2014`, `ANSI/ISA-61511-1-2018`, `ANSI/TIA-568.2-D`. They need a
31
- `-` separator after the co-publisher (an equality-ignored spelling flag), a
32
- second dash group for part + year, and letter revisions for TIA.
29
+ - **The dash after the acronym** (`ANSI/ISA-5.1-2009`, `ANSI/ANS-8.1-2014`,
30
+ `ANSI/ISA-61511-1-2018`, `ANSI/TIA-568.2-D`). Three grammar pieces:
31
+ (1) only `identifier_with_copublishers` takes `"-" as number_separator`
32
+ in place of the space; `number_separator` is `equality_ignored` (nil = the
33
+ space) and the pubid-URN facet `numsep`, so `ANSI/ISA-5.1 == ANSI/ISA 5.1`.
34
+ `#exclude(:year)` keeps it — it belongs to the publisher group, not the year.
35
+ (2) `number_with_part` takes a second dash group, but only a 19xx/20xx year
36
+ not followed by a digit or a colon, so the builder reads a third split group
37
+ as the year with no test, and `X9.8-1-2007:2009` fails instead of silently
38
+ dropping `2007`. The two-group case still goes through `read_dash_year`,
39
+ which skips an id with a revision: in `568-2009-D` the `2009` is a part,
40
+ because the renderer prints the revision before the date. The space form
41
+ gets the second group too (`ANSI X9.8-1-2007`). (3) `revision` is one
42
+ uppercase letter after a dash, not followed by a letter or digit (`-DE`
43
+ fails). It is identity (`revision_of?` reads it), the pubid-URN atom `rev`,
44
+ an official URN segment `rev-D` and an MR-slug suffix
45
+ (`#mr_number_with_part`), so `568.2-C` and `568.2-D` do not collide. Not
46
+ supported: a year after the revision (`568.2-D-2016`) and TIA addenda
47
+ (`568-C.2`). The official `UrnParser` refuses every co-published URN
48
+ (`urn:ansi-isa:…`), as it did before. **Measured** against a `main`
49
+ replay of every ansi/ieee/amca/ashrae fixture id: no `to_s`, `to_hash`,
50
+ `to_urn` or pubid URN moved, and one route is new: `ANSI/IEEE Std
51
+ 260-4-1996` failed in every flavor and now routes to ANSI as
52
+ `ANSI/IEEE 260-4-1996`. It loses `Std`, because the ANSI grammar never
53
+ captures `["Std "]` (`ANSI Std A119.1` renders `ANSI A119.1` on `main`
54
+ too).
33
55
  - **Routing umbrella.** With the open list, ANSI parses `ANSI/AMCA 210-16`
34
56
  exactly while AMCA normalizes it (`ANSI/AMCA Standard 210-16`), so plain
35
57
  routing would have handed it to ANSI. `Pubid::Ansi.routing_umbrella?` is
@@ -19,13 +19,28 @@ module Pubid
19
19
  private
20
20
 
21
21
  def read_dash_year(identifier)
22
- return if identifier.date || !DASH_YEAR.match?(identifier.part.to_s)
22
+ # A revision follows the part, so "568-2009-D" keeps 2009 as a part:
23
+ # read as a year, it would render after the revision.
24
+ return if identifier.date || identifier.revision
25
+ return unless DASH_YEAR.match?(identifier.part.to_s)
23
26
 
24
27
  identifier.date = Components::Date.new(year: identifier.part)
25
28
  identifier.date_separator = "-"
26
29
  identifier.part = nil
27
30
  end
28
31
 
32
+ # A third dash group is always the year: the grammar admits only a
33
+ # 19xx/20xx group there ("ANSI/ISA-61511-1-2018").
34
+ def split_number_with_part(value)
35
+ number, part, dash_year = value.split("-")
36
+ {
37
+ number: number,
38
+ part: part,
39
+ date: dash_year && Components::Date.new(year: dash_year),
40
+ date_separator: dash_year && "-",
41
+ }.compact
42
+ end
43
+
29
44
  def default_identifier_class
30
45
  Identifiers::Standard
31
46
  end
@@ -45,14 +60,9 @@ module Pubid
45
60
  end
46
61
  end
47
62
  when :number_with_part
48
- original_value = value.to_s
49
- main_and_parts = original_value.split("-")
50
- main_number = main_and_parts[0]
51
- part_number = main_and_parts[1]
52
- {
53
- number: main_number,
54
- part: part_number,
55
- }.compact
63
+ split_number_with_part(value.to_s)
64
+ when :number_separator, :revision
65
+ value.to_s
56
66
  when :date
57
67
  Components::Date.new(year: value.to_s)
58
68
  when :languages
@@ -19,6 +19,16 @@ module Pubid
19
19
  attribute :date_separator, :string
20
20
  equality_ignored :date_separator
21
21
 
22
+ # How the input joined the publisher group to the number: "-" for the
23
+ # "ANSI/ISA-5.1-2009" spelling, nil for the space of "ANSI/ISA 5.1".
24
+ # Spelling only, so `==`, `hash` and `===` skip it.
25
+ attribute :number_separator, :string
26
+ equality_ignored :number_separator
27
+
28
+ # The revision letter of "ANSI/TIA-568.2-D". It names a different
29
+ # document, so it is identity; `#revision_of?` reads it.
30
+ attribute :revision, :string
31
+
22
32
  def self.parse(string)
23
33
  unless string.is_a?(String)
24
34
  raise Pubid::Errors::InvalidInputError,
@@ -35,6 +45,13 @@ module Pubid
35
45
  Pubid::Ansi::Builder.new.build(parsed)
36
46
  end
37
47
 
48
+ # The revision is identity, so it reaches the slug too: "568.2-C" and
49
+ # "568.2-D" must not share a filename.
50
+ def mr_number_with_part
51
+ num = super
52
+ num && mr_join(num, revision&.downcase)
53
+ end
54
+
38
55
  # The separator belongs to the year: drop it with the year, so a
39
56
  # year-less copy carries no orphan spelling flag in its hash.
40
57
  def exclude(*args)
@@ -22,6 +22,7 @@ module Pubid
22
22
  atom "type.abbr", "type"
23
23
  atom "part", "part"
24
24
  atom "subpart", "subpart"
25
+ atom "revision", "rev"
25
26
  atom "year", "year"
26
27
  atom "date.year", "dateyear"
27
28
  atom "date.month", "datemonth"
@@ -36,6 +37,7 @@ module Pubid
36
37
  facet "languages.*.original_code", "langsrc"
37
38
  facet "edition.original_text", "edsrc"
38
39
  facet "date_separator", "datesep"
40
+ facet "number_separator", "numsep"
39
41
 
40
42
  type "pubid:ansi:standard", "std"
41
43
  type "pubid:ansi:american-national-standard", "ans"
@@ -16,10 +16,11 @@ module Pubid
16
16
  def render(context: nil, **opts)
17
17
  id = @id
18
18
 
19
- parts = []
20
- parts << publisher_portion(id, context)
21
- parts << number_portion(id, context)
22
- result = parts.compact.join(" ")
19
+ # "ANSI/ISA-5.1-2009" keeps its dash; the space is the default.
20
+ result = [
21
+ publisher_portion(id, context),
22
+ number_portion(id, context),
23
+ ].join(id.number_separator || " ")
23
24
 
24
25
  result << language_portion(id) if id.languages&.any?
25
26
 
@@ -40,6 +41,7 @@ module Pubid
40
41
  [
41
42
  id.number,
42
43
  (id.part ? "-#{id.part}" : ""),
44
+ (id.revision ? "-#{id.revision}" : ""),
43
45
  date_portion(id, context),
44
46
  ].join
45
47
  end
@@ -18,6 +18,8 @@ module Pubid
18
18
  parts << urn_part if urn_part
19
19
  parts << urn_subpart if urn_subpart
20
20
  parts << urn_year if urn_year
21
+ # "568.2-C" and "568.2-D" are two documents: keep them apart.
22
+ parts << "rev-#{identifier.revision}" if identifier.revision
21
23
  parts << urn_edition if urn_edition
22
24
  parts << urn_typed_stage if urn_typed_stage
23
25
 
data/lib/pubid/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pubid
4
- VERSION = "2.0.47"
4
+ VERSION = "2.0.48"
5
5
  end
@@ -0,0 +1,114 @@
1
+ # WMO flavor notes
2
+
3
+ WMO (World Meteorological Organization) publication identifiers and
4
+ their MRN URNs (pubid#763): the WMO-No. series and, since the JCOMM
5
+ dissolution, the WMO-published S-100-family product specifications
6
+ (consumer: metanorma/S-411-Product-Specification, authored
7
+ `mn-document-class: wmo` in the metanorma-taste `data/wmo` flavor).
8
+
9
+ Read this before you change `lib/pubid/wmo/` or `spec/pubid/wmo/`. The
10
+ root `CLAUDE.md` keeps the cross-flavor contract that every flavor
11
+ obeys.
12
+
13
+ ## The type assignment (the #763 ruling)
14
+
15
+ The S-100 type assignment follows the fleet's own precedent: IALA's
16
+ `S-201` is the S-100-family lexical form under the publishing org's
17
+ flavor (`Pubid::Iala`, `urn:mrn:iala:pub:s-201:ed2.0.0`). WMO-published
18
+ `S-411` is the same shape, so it is a **Pubid::Wmo** type — the
19
+ S-lexical form as a WMO type, publisher-parameterised, not a Pubid::Iho
20
+ identifier. The bare `S-411` string alone still names two documents
21
+ (IHO's and WMO's — each org assigns its own identifier), so like the
22
+ pubid#469 dual-perspective shapes the lexical form leads NO prefix and
23
+ `PREFIXES` carries only `WMO-No.`; the umbrella router reaches WMO's
24
+ S-411 through the exact-round-trip preference, never through a claimed
25
+ prefix.
26
+
27
+ ## Identifier space
28
+
29
+ | Type | Shape | Edition face | Example |
30
+ |------|-------|--------------|---------|
31
+ | Publication | `WMO-No. <n>` | calendar year: `, 2025 edition` | `WMO-No. 1364, 2025 edition` |
32
+ | Standard | `S-<n>` | dotted x.y.z: ` 1.2.1` | `S-411 1.2.1` |
33
+ | Annex | `S-<n> Annex <L>` (wrapper over Standard) | dotted, on the annex | `S-411 Annex A` |
34
+
35
+ - **Editions are one string attribute with a type-driven face.** The
36
+ issue's semantics: WMO editions are calendar years (`2025 edition`)
37
+ on the WMO-No. series, the S-100 shapes carry the dotted `ed1.2.1`
38
+ MRN form. The grammar binds both into the one `edition_value`
39
+ capture; the renderer and the MRN generator key the face off the
40
+ resolved type. There is no Components::Edition.
41
+ - **Parse-only alternates**: the cover-stack year face
42
+ (`WMO-No. 1364 2025 edition`), the compact aliases
43
+ (`WMO-No. 1364:ed2025`, `S-411:ed1.2.1`) and the uppercase `ANNEX`
44
+ marker all parse and normalize; the canonical faces are the
45
+ repository forms (`S-411 1.2.1`, `S-411 Annex A`) and the WMO catalog
46
+ citation (`WMO-No. 1364, 2025 edition`).
47
+ - **The dotted S-100 edition requires a dot** (`S-411 1.2` parses,
48
+ `S-411 1234` rejects): a bare digit run after the code is not an
49
+ edition face in either series, and the year face (4 digits) is
50
+ publication-only. `WMO-No. 1364:ed1.2.1` rejects for the same reason.
51
+
52
+ ## The faces carry no publisher token
53
+
54
+ `WMO-No.` is the series designation (the GB/GOST rule) and the S-number
55
+ prints bare — the repository's docidentifiers are `S-411 Annex A` and
56
+ `S-411 1.2.1`, never `WMO S-411`. `publisher_prefixes` is `[]`, so
57
+ `to_s(with_publisher:)` is the identity on every type.
58
+
59
+ ## MRN URN scheme
60
+
61
+ The `mrn` URN tree with WMO as assigning authority, sub-namespace
62
+ `pub`, following the IALA pattern:
63
+
64
+ ```
65
+ urn:mrn:wmo:pub:wmo-<number>[:ed<year>]
66
+ urn:mrn:wmo:pub:s-<number>[:annex[-<letter>]][:ed<x.y.z>]
67
+ ```
68
+
69
+ - The WMO-No. series codes as `wmo-<number>` and its edition segment is
70
+ the year (`urn:mrn:wmo:pub:wmo-1364:ed2025`); the S-100 specs keep
71
+ their lexical form lowercased (`s-411`) with the dotted edition
72
+ (`urn:mrn:wmo:pub:s-411:ed1.2.1`).
73
+ - **No authoritative rule exists yet.** The issue asked for a search
74
+ before assuming the shape: neither the S-411 repository nor any local
75
+ checkout carries a `urn:mrn:wmo:` spelling, so this generator/parser
76
+ pair IS the namespace extension, recorded as the issue's proposed
77
+ form. If WMO publishes a rule, that rule wins and this pair moves.
78
+ - The parser rebuilds the human forms and delegates to the text parser
79
+ (one construction path). The MRN annex segment is caseless
80
+ (`annex-a`), so the rebuild picks the attested face `Annex` — the
81
+ uppercase `ANNEX` human form stays a parse-only alias whose URN
82
+ re-renders to the attested face. Unknown/duplicate/reordered segments
83
+ raise `Pubid::Errors::UrnParseError` (the ISO urn_parser strictness).
84
+
85
+ ## pubid-scheme URN (docs/URN-SCHEMES.adoc, `[[urn-wmo]]`)
86
+
87
+ `lib/pubid/wmo/pubid_urn_schema.rb`: atoms `ed-` (`edition`),
88
+ `annexform-` (`annex_form`), `letter-` (`letter`); types
89
+ `pub`/`std`/`annex` over the default `number` core. The annex rides the
90
+ root-first chain (`urn:pubid:wmo:std:411:annex:annexform-Annex:
91
+ letter-A`), so the base standard is the slug prefix. `annex_form` is an
92
+ atom (identity) per the iala schema — "Annex" and "ANNEX" are two
93
+ identifiers.
94
+
95
+ ## Corpus ground truth (attested only)
96
+
97
+ `spec/fixtures/wmo/identifiers/full/identifiers.txt`, regenerated by
98
+ `rake "validation:classify[wmo]"`:
99
+
100
+ - `WMO-No. 8`, `WMO-No. 49`, `WMO-No. 1364` — the issue's series
101
+ examples; `2025 edition` — the issue's calendar-year face.
102
+ - `S-411 1.2.1` (PS), `S-411 1.2.0` (DCEG), `S-411 Annex A` (the DCEG
103
+ `:docidentifier:`), `S-411 1.1.0` (the June 2014 original PDF) —
104
+ metanorma/S-411-Product-Specification; `S-412` — the issue.
105
+ - The MRN URN rows are the issue's proposed forms over those rows.
106
+
107
+ ## relaton-side follow-ups (not this repo)
108
+
109
+ bibdata carries the plain string `S-411` today; a relaton-side ask for
110
+ docidentifier types and MRN URNs is to be filed in the relaton monogem
111
+ and cross-linked on #763. metanorma-taste's `data/wmo` flavor registers
112
+ its URN generator the way `Metanorma::Taste::UrnGenerator.register`
113
+ does for the other flavors, so S-411 documents mint the publication
114
+ URN from fields instead of hand-pinning a `:urn:` attribute.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ # Builds a WMO identifier object from the artifact's bound map —
6
+ # the flat attribute hash the grammar's bindings block declares
7
+ # (typed at the engine, one key per capture).
8
+ #
9
+ # Each grammar alternative path carries exactly one occurrence of
10
+ # `doc_number` and `edition_value`, so one flat map serves all three
11
+ # types; the builder dispatches on `annex_marker` and `wmomarker`.
12
+ class Builder
13
+ def build(parsed)
14
+ return build_annex(parsed) if parsed[:annex_marker]
15
+ return build_publication(parsed) if parsed[:wmomarker]
16
+
17
+ Identifiers::Standard.new(**standard_attrs(parsed))
18
+ end
19
+
20
+ def self.build(parsed)
21
+ new.build(parsed)
22
+ end
23
+
24
+ private
25
+
26
+ def build_publication(hash)
27
+ Identifiers::Publication.new(**standard_attrs(hash))
28
+ end
29
+
30
+ def build_annex(hash)
31
+ base = Identifiers::Standard.new(number: hash[:doc_number])
32
+
33
+ attrs = {
34
+ base: base,
35
+ annex_form: hash[:annex_marker],
36
+ letter: hash[:annex_letter],
37
+ edition: hash[:edition_value],
38
+ }.compact
39
+
40
+ Identifiers::Annex.new(**attrs)
41
+ end
42
+
43
+ def standard_attrs(hash)
44
+ {
45
+ number: hash[:doc_number],
46
+ edition: hash[:edition_value],
47
+ }.compact
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ Pubid::Wmo::Builder.prepend(Pubid::Builder::AllPartsWrap)
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ # Base class for all WMO identifiers. Canonical name
6
+ # Pubid::Wmo::Identifier; every concrete WMO identifier
7
+ # (Identifiers::*) descends from it.
8
+ #
9
+ # Two series share the flavor (pubid#763):
10
+ #
11
+ # WMO-No. <number>[, <year> edition] the WMO-No. publication
12
+ # series; editions are
13
+ # calendar years
14
+ # S-<number>[ <x.y.z>] the WMO-published S-100
15
+ # product specifications;
16
+ # editions are dotted x.y.z
17
+ # S-<number> [Annex|ANNEX] [<letter>] [<x.y.z>] annex wrapper
18
+ #
19
+ # The edition is ONE string attribute carrying a type-driven face:
20
+ # "2025" on a Publication, "1.2.1" on a Standard or Annex. The
21
+ # renderer and the MRN URN generator key the face off the type.
22
+ class Identifier < ::Pubid::Identifier
23
+ # Parse a WMO identifier string — human form ("WMO-No. 1364",
24
+ # "S-411 1.2.1") or MRN URN ("urn:mrn:wmo:pub:s-411:ed1.2.1") —
25
+ # into an identifier.
26
+ # @param identifier [String]
27
+ # @return [Pubid::Wmo::Identifier]
28
+ # @raise [Pubid::Errors::ParseError] If parsing fails
29
+ def self.parse(identifier)
30
+ unless identifier.is_a?(String)
31
+ raise Pubid::Errors::InvalidInputError,
32
+ Pubid::INPUT_NOT_A_STRING_MESSAGE
33
+ end
34
+
35
+ if identifier.length > Pubid::MAX_INPUT_LENGTH
36
+ raise Pubid::Errors::InvalidInputError, Pubid::INPUT_TOO_LONG_MESSAGE
37
+ end
38
+
39
+ identifier = ::Pubid.utf8_input(identifier)
40
+
41
+ if FormatDetector.detect(identifier) == :urn
42
+ UrnParser.parse(identifier)
43
+ else
44
+ parsed = Pubid::Parg::Model.bound(:wmo, identifier)
45
+ Builder.build(parsed)
46
+ end
47
+ end
48
+
49
+ attribute :publisher, :string, default: "WMO"
50
+ attribute :number, :string # "1364", "411"
51
+ # One edition column, type-driven face: "2025" (the WMO-No. series'
52
+ # calendar-year edition) or "1.2.1" (the S-100 dotted edition).
53
+ attribute :edition, :string
54
+
55
+ WMO_TYPE_MAP = {
56
+ "pubid:wmo:publication" => "Pubid::Wmo::Identifiers::Publication",
57
+ "pubid:wmo:standard" => "Pubid::Wmo::Identifiers::Standard",
58
+ "pubid:wmo:annex" => "Pubid::Wmo::Identifiers::Annex",
59
+ }.freeze
60
+
61
+ key_value do
62
+ map "_type", to: :_type, polymorphic_map: WMO_TYPE_MAP
63
+ map "number", to: :number
64
+ map "edition", to: :edition
65
+ end
66
+
67
+ def to_urn
68
+ UrnGenerator.new(self).generate
69
+ end
70
+
71
+ # The edition is a plain string (the string-edition flavors precede
72
+ # this); the base mr_edition reads edition.number of a
73
+ # Components::Edition, which would crash on the string.
74
+ def mr_edition
75
+ return nil unless edition
76
+
77
+ "ed#{edition}"
78
+ end
79
+
80
+ # "WMO-No." and the S-number are designations, not publisher
81
+ # tokens: the canonical faces carry no publisher prefix for
82
+ # with_publisher to cut (the GB/GOST/ECMA rule).
83
+ def publisher_prefixes
84
+ []
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ module Identifiers
6
+ # An annex to a WMO-published S-100 product specification:
7
+ # "S-411 Annex A" (the Data Classification and Encoding Guide's
8
+ # docidentifier in metanorma/S-411-Product-Specification). The
9
+ # marker case is preserved (Annex vs ANNEX) for round-trip
10
+ # fidelity; the optional edition applies to the annex itself,
11
+ # not the base.
12
+ class Annex < Identifier
13
+ # The specification this annex supplements. Always present;
14
+ # carries the S-number (e.g. S-411).
15
+ attribute :base, ::Pubid::Wmo::Identifier, polymorphic: true
16
+ # "Annex" or "ANNEX" — preserved verbatim for exact round-trip.
17
+ attribute :annex_form, :string
18
+ # "A", "B", … or nil for the bare form.
19
+ attribute :letter, :string
20
+
21
+ key_value do
22
+ map "base", to: :base
23
+ map "annex_form", to: :annex_form
24
+ map "letter", to: :letter
25
+ end
26
+
27
+ def self.type
28
+ { key: :annex, title: "Annex", short: nil }
29
+ end
30
+
31
+ # MR string: the base head, then the annex marker (and letter),
32
+ # then the annex's own edition — "wmo.411_annex-a.ed1.2.0".
33
+ # Returning non-nil is what makes the shared MrString renderer
34
+ # recurse into `base` for the head.
35
+ def mr_supplement_suffix
36
+ segments = [letter ? "annex-#{letter.downcase}" : "annex"]
37
+ segments << "ed#{edition}" if edition
38
+ segments.join(".")
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ module Identifiers
6
+ # The WMO-No. publication series: "WMO-No. 8", "WMO-No. 49",
7
+ # "WMO-No. 1364". Editions are calendar years — "2025 edition" —
8
+ # never version ordinals; the MRN edition segment is ed<year>
9
+ # (urn:mrn:wmo:pub:wmo-1364:ed2025).
10
+ class Publication < Identifier
11
+ def self.type
12
+ { key: :publication, title: "Publication", short: nil }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ module Identifiers
6
+ # The WMO-published S-100 product specifications: the IHO S-100
7
+ # lexical form ("S-411", "S-412") with WMO as the assigning
8
+ # authority — the S-201-of-IALA type assignment of the #763
9
+ # ruling. Editions are the S-100 dotted x.y.z ("S-411 1.2.1",
10
+ # MRN ed1.2.1).
11
+ class Standard < Identifier
12
+ def self.type
13
+ { key: :standard, title: "Standard", short: "S" }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ module Identifiers
6
+ autoload :Annex, "#{__dir__}/identifiers/annex"
7
+ autoload :Publication, "#{__dir__}/identifiers/publication"
8
+ autoload :Standard, "#{__dir__}/identifiers/standard"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ # Grammar for WMO identifiers.
6
+ #
7
+ # Accepts every attested shape (pubid#763):
8
+ #
9
+ # WMO-No. 1364
10
+ # WMO-No. 1364, 2025 edition
11
+ # WMO-No. 1364 2025 edition
12
+ # WMO-No. 1364:ed2025
13
+ # S-411
14
+ # S-411 1.2.1
15
+ # S-411:ed1.2.1
16
+ # S-411 Annex A
17
+ class Parser
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ # The pubid-scheme URN of wmo (pubid#763; docs/URN-SCHEMES.adoc).
6
+ #
7
+ # WMO-No. 1364, 2025 edition -> urn:pubid:wmo:pub:1364:ed-2025
8
+ # S-411 1.2.1 -> urn:pubid:wmo:std:411:ed-1.2.1
9
+ # S-411 Annex A -> urn:pubid:wmo:std:411:annex:annexform-Annex:letter-A
10
+ #
11
+ # The edition is one atom: a calendar-year face on a publication,
12
+ # a dotted face on a standard or annex. The annex marker and letter
13
+ # follow the iala schema (annexform- / letter-).
14
+ PubidUrnSchema = Pubid::PubidUrn.define("wmo") do
15
+ atom "edition", "ed"
16
+ atom "annex_form", "annexform"
17
+ atom "letter", "letter"
18
+
19
+ type "pubid:wmo:publication", "pub"
20
+ type "pubid:wmo:standard", "std"
21
+ type "pubid:wmo:annex", "annex"
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ # Human-readable renderer for WMO identifiers.
6
+ #
7
+ # Produces strings like:
8
+ # "WMO-No. 1364"
9
+ # "WMO-No. 1364, 2025 edition"
10
+ # "S-411"
11
+ # "S-411 1.2.1"
12
+ # "S-411 Annex A"
13
+ #
14
+ # The faces carry no publisher token — "WMO-No." is the series
15
+ # designation and the S-number prints bare (the repository form) —
16
+ # so to_s(with_publisher:) is the identity on every type.
17
+ class Renderer < ::Pubid::Renderers::Base
18
+ def render(context: nil, **_opts)
19
+ id = @id
20
+
21
+ return render_annex(id) if id.is_a?(Identifiers::Annex)
22
+ return render_publication(id) if id.is_a?(Identifiers::Publication)
23
+
24
+ rendered = "S-#{id.number}"
25
+ rendered << " #{id.edition}" if id.edition
26
+ rendered
27
+ end
28
+
29
+ def render_publication(id)
30
+ rendered = "WMO-No. #{id.number}"
31
+ rendered << ", #{id.edition} edition" if id.edition
32
+ rendered
33
+ end
34
+
35
+ # The marker case is preserved verbatim ("Annex" vs "ANNEX").
36
+ def render_annex(id)
37
+ rendered = "S-#{id.base.number} #{id.annex_form}"
38
+ rendered << " #{id.letter}" if id.letter
39
+ rendered << " #{id.edition}" if id.edition
40
+ rendered
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ # Generates URN strings for WMO identifiers under the WMO assigning
6
+ # authority of the IANA-registered `mrn` namespace, following the
7
+ # IALA pattern (pubid#763 proposed form; no authoritative WMO
8
+ # urn:mrn:wmo: rule is published — the S-411 repository carries none
9
+ # — so this shape is the fleet's extension until one exists):
10
+ #
11
+ # urn:mrn:wmo:pub:wmo-<number>[:ed<year>] the WMO-No. series
12
+ # urn:mrn:wmo:pub:s-<number>[:ed<x.y.z>] the S-100 specs
13
+ # urn:mrn:wmo:pub:s-<number>:annex[-<letter>][:ed<x.y.z>]
14
+ #
15
+ # Examples:
16
+ # urn:mrn:wmo:pub:wmo-1364:ed2025
17
+ # urn:mrn:wmo:pub:s-411:ed1.2.1
18
+ # urn:mrn:wmo:pub:s-411:annex-a
19
+ class UrnGenerator
20
+ attr_reader :identifier
21
+
22
+ def initialize(identifier)
23
+ @identifier = identifier
24
+ end
25
+
26
+ def generate
27
+ return generate_annex if identifier.is_a?(Identifiers::Annex)
28
+
29
+ parts = ["urn:mrn:wmo:pub", code_segment]
30
+ parts << "ed#{identifier.edition}" if identifier.edition
31
+ parts.join(":")
32
+ end
33
+
34
+ private
35
+
36
+ # The WMO-No. series codes as "wmo-<number>" (the proposed MRN
37
+ # form "urn:mrn:wmo:pub:wmo-1364:ed2025"); the S-100 specs keep
38
+ # their lexical form lowercased ("s-411").
39
+ def code_segment
40
+ if identifier.is_a?(Identifiers::Publication)
41
+ "wmo-#{identifier.number}"
42
+ else
43
+ "s-#{identifier.number}"
44
+ end
45
+ end
46
+
47
+ # URN for an annex: the base specification's code, then an "annex"
48
+ # segment (lettered form for the "ANNEX A" style, bare for "Annex"
49
+ # without a letter), then the annex's own edition.
50
+ def generate_annex
51
+ base = identifier.base
52
+ parts = ["urn:mrn:wmo:pub", "s-#{base.number}"]
53
+ parts << annex_segment
54
+ parts << "ed#{identifier.edition}" if identifier.edition
55
+ parts.join(":")
56
+ end
57
+
58
+ def annex_segment
59
+ if identifier.letter
60
+ "annex-#{identifier.letter.downcase}"
61
+ else
62
+ "annex"
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,117 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Wmo
5
+ # Parses WMO MRN URNs back into identifiers.
6
+ #
7
+ # UrnGenerator emits:
8
+ # urn:mrn:wmo:pub:wmo-<number>[:ed<year>]
9
+ # urn:mrn:wmo:pub:s-<number>[:ed<x.y.z>]
10
+ # urn:mrn:wmo:pub:s-<number>:annex[-<letter>][:ed<x.y.z>]
11
+ #
12
+ # Examples:
13
+ # urn:mrn:wmo:pub:wmo-1364:ed2025 → WMO-No. 1364, 2025 edition
14
+ # urn:mrn:wmo:pub:s-411:ed1.2.1 → S-411 1.2.1
15
+ # urn:mrn:wmo:pub:s-411:annex-a → S-411 Annex A
16
+ class UrnParser < Pubid::UrnParser::Base
17
+ PREFIX = "urn:mrn:wmo:pub:"
18
+
19
+ def parse_urn(urn)
20
+ body = strip_mrn_namespace(urn)
21
+ parts = split_parts(body)
22
+ code = parts.fetch(0)
23
+ segments = parts.drop(1)
24
+
25
+ if (publication = code.match(/\Awmo-(\d+)\z/i))
26
+ parse_publication(publication[1], segments)
27
+ elsif (standard = code.match(/\As-(\d+)\z/i))
28
+ parse_standard(standard[1], segments)
29
+ else
30
+ raise ::Pubid::Errors::UrnParseError,
31
+ "Invalid WMO URN code segment: #{code.inspect}"
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ def strip_mrn_namespace(urn)
38
+ unless urn.downcase.start_with?(PREFIX)
39
+ raise ::Pubid::Errors::UrnParseError,
40
+ "Invalid WMO URN: #{urn.inspect}"
41
+ end
42
+
43
+ urn[PREFIX.length..]
44
+ end
45
+
46
+ # Publication segments: the single ed<year> edition. Rebuilt as the
47
+ # compact year form, which the text parser normalizes to the
48
+ # canonical comma face.
49
+ def parse_publication(number, segments)
50
+ edition = nil
51
+
52
+ segments.each do |seg|
53
+ raise_segment!(seg, "duplicate edition") if edition
54
+ edition = edition_value(seg, /\A\d{4}\z/)
55
+ end
56
+
57
+ text = "WMO-No. #{number}"
58
+ text += ":ed#{edition}" if edition
59
+ flavor_parse(text)
60
+ end
61
+
62
+ # Standard and annex segments: an optional annex segment (at most
63
+ # one), then the optional dotted edition. Rebuilt as the human
64
+ # forms.
65
+ #
66
+ # The annex segment is caseless in the MRN ("annex" / "annex-a"),
67
+ # so the rebuild picks the attested WMO face "Annex" (the DCEG
68
+ # docidentifier). The uppercase "ANNEX" form stays a parse-only
69
+ # human alias; its URN re-renders to the attested face.
70
+ def parse_standard(number, segments)
71
+ annex_letter = nil
72
+ edition = nil
73
+ has_annex = false
74
+
75
+ segments.each do |seg|
76
+ case seg
77
+ when /\Aannex(-([a-z]))?\z/i
78
+ raise_segment!(seg, "duplicate annex") if has_annex
79
+
80
+ has_annex = true
81
+ annex_letter = Regexp.last_match(2)&.upcase
82
+ else
83
+ raise_segment!(seg) if edition
84
+
85
+ edition = edition_value(seg, /\A\d+(\.\d+)+\z/)
86
+ end
87
+ end
88
+
89
+ text = "S-#{number}"
90
+ text += " Annex" if has_annex
91
+ text += " #{annex_letter}" if annex_letter
92
+ text += " #{edition}" if edition
93
+ flavor_parse(text)
94
+ end
95
+
96
+ # The value of an "ed<value>" segment, validated against +shape+
97
+ # (a year for a publication, dotted for a standard or annex). Any
98
+ # other segment is a parse error, per the ISO urn_parser strictness.
99
+ def edition_value(seg, shape)
100
+ unless seg.match?(/\Aed/i)
101
+ raise_segment!(seg)
102
+ end
103
+
104
+ edition = seg.sub(/\Aed/i, "")
105
+ return edition if edition.match?(shape)
106
+
107
+ raise_segment!(seg)
108
+ end
109
+
110
+ def raise_segment!(seg, reason = nil)
111
+ detail = reason ? " (#{reason})" : ""
112
+ raise ::Pubid::Errors::UrnParseError,
113
+ "Invalid WMO URN segment#{detail}: #{seg.inspect}"
114
+ end
115
+ end
116
+ end
117
+ end
data/lib/pubid/wmo.rb ADDED
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pubid"
4
+ module Pubid
5
+ # WMO (World Meteorological Organization) document identifiers
6
+ # (pubid#763): the WMO-No. publication series and, since the JCOMM
7
+ # dissolution, the WMO-published S-100-family product specifications.
8
+ #
9
+ # WMO-No. 1364 the WMO-No. series, bare
10
+ # WMO-No. 1364, 2025 edition year edition (calendar years)
11
+ # S-411 WMO-published S-100 spec, bare
12
+ # S-411 1.2.1 dotted edition (the S-411 repo form)
13
+ # S-411 Annex A annex wrapper (the DCEG docidentifier)
14
+ #
15
+ # The S-lexical type assignment is the #763 ruling: the lexical shape is
16
+ # the IHO S-100 form, but the flavor owns the WMO-published documents —
17
+ # the same publisher-parameterised split as IALA's S-201 (Pubid::Iala,
18
+ # urn:mrn:iala:pub:s-201:ed2.0.0). See lib/pubid/wmo/CLAUDE.md.
19
+ module Wmo
20
+ extend Pubid::PrefixesSupport
21
+
22
+ # The leading series token of the WMO-No. publication series. The
23
+ # S-100 lexical form ("S-411") deliberately leads NO prefix: a bare
24
+ # S-number is the shared S-100 shape of two assigning authorities
25
+ # (IHO and WMO), so each flavor parses it and neither owns the
26
+ # routing (the pubid#469 dual-perspective policy).
27
+ PREFIXES = ["WMO-No."].freeze
28
+
29
+ autoload :Builder, "#{__dir__}/wmo/builder"
30
+ autoload :Identifier, "#{__dir__}/wmo/identifier"
31
+ autoload :Identifiers, "#{__dir__}/wmo/identifiers"
32
+ autoload :Parser, "#{__dir__}/wmo/parser"
33
+ autoload :Renderer, "#{__dir__}/wmo/renderer"
34
+ autoload :UrnGenerator, "#{__dir__}/wmo/urn_generator"
35
+ autoload :UrnParser, "#{__dir__}/wmo/urn_parser"
36
+ autoload :PubidUrnSchema, "#{__dir__}/wmo/pubid_urn_schema"
37
+
38
+ # Parse a WMO identifier string into an identifier object.
39
+ # @param identifier [String] The WMO identifier string to parse
40
+ # @return [Pubid::Wmo::Identifier]
41
+ def self.parse(identifier)
42
+ Identifier.parse(identifier)
43
+ end
44
+
45
+ # Per-flavor format registry: inherits global formats, overrides :human
46
+ Identifier.format_registry = FormatRegistry.new(parent: ::Pubid::Identifier.format_registry)
47
+ Identifier.format_registry.register(:human, renderer: Wmo::Renderer)
48
+
49
+ # Auto-discover all identifier types from the Identifiers namespace.
50
+ # @return [Array<Class>] identifier classes (Pubid::Identifier subclasses)
51
+ def self.identifier_types
52
+ @identifier_types ||= Identifiers.constants
53
+ .filter_map { |c| resolve_identifier_constant(c) }
54
+ end
55
+
56
+ # One Identifiers constant as an identifier class, or nil: a constant
57
+ # that does not resolve, or resolves to anything but a Pubid::Identifier
58
+ # subclass, is not a type.
59
+ # @param const [Symbol]
60
+ # @return [Class, nil]
61
+ def self.resolve_identifier_constant(const)
62
+ klass = Identifiers.const_get(const)
63
+ return if !klass.is_a?(Class) || !(klass < Pubid::Identifier)
64
+
65
+ klass unless klass == Identifier
66
+ rescue NameError
67
+ nil
68
+ end
69
+
70
+ # WMO identifiers carry no typed stages.
71
+ # @return [Array<Pubid::Components::TypedStage>]
72
+ def self.all_typed_stages
73
+ []
74
+ end
75
+
76
+ # Lookup: type code -> identifier class
77
+ # @param code [String, Symbol]
78
+ # @return [Class, nil]
79
+ def self.locate_type(code)
80
+ identifier_types.find { |t| t.type[:key].to_s == code.to_s }
81
+ end
82
+
83
+ # WMO identifiers carry no typed stages.
84
+ # @param _abbr [String, Symbol]
85
+ # @return [nil]
86
+ def self.locate_stage(_abbr)
87
+ nil
88
+ end
89
+ end
90
+ end
91
+
92
+ Pubid::Registry.register(:wmo, Pubid::Wmo)
data/lib/pubid.rb CHANGED
@@ -285,6 +285,7 @@ module Pubid
285
285
  autoload :Sae, "pubid/sae"
286
286
  autoload :Tgpp, "pubid/tgpp"
287
287
  autoload :Un, "pubid/un"
288
+ autoload :Wmo, "pubid/wmo"
288
289
  autoload :Xsf, "pubid/xsf"
289
290
  autoload :W3c, "pubid/w3c"
290
291
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.47
4
+ version: 2.0.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -156,6 +156,8 @@ files:
156
156
  - data/parg/tgpp.json
157
157
  - data/parg/un.json
158
158
  - data/parg/w3c.json
159
+ - data/parg/wmo.json
160
+ - data/parg/wmo.parg
159
161
  - data/parg/xsf.json
160
162
  - data/plateau/update_codes.yaml
161
163
  - lib/pubid.rb
@@ -1206,6 +1208,19 @@ files:
1206
1208
  - lib/pubid/w3c/renderer.rb
1207
1209
  - lib/pubid/w3c/urn_generator.rb
1208
1210
  - lib/pubid/w3c/urn_parser.rb
1211
+ - lib/pubid/wmo.rb
1212
+ - lib/pubid/wmo/CLAUDE.md
1213
+ - lib/pubid/wmo/builder.rb
1214
+ - lib/pubid/wmo/identifier.rb
1215
+ - lib/pubid/wmo/identifiers.rb
1216
+ - lib/pubid/wmo/identifiers/annex.rb
1217
+ - lib/pubid/wmo/identifiers/publication.rb
1218
+ - lib/pubid/wmo/identifiers/standard.rb
1219
+ - lib/pubid/wmo/parser.rb
1220
+ - lib/pubid/wmo/pubid_urn_schema.rb
1221
+ - lib/pubid/wmo/renderer.rb
1222
+ - lib/pubid/wmo/urn_generator.rb
1223
+ - lib/pubid/wmo/urn_parser.rb
1209
1224
  - lib/pubid/xsf.rb
1210
1225
  - lib/pubid/xsf/CLAUDE.md
1211
1226
  - lib/pubid/xsf/builder.rb
@@ -1249,7 +1264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1249
1264
  - !ruby/object:Gem::Version
1250
1265
  version: '0'
1251
1266
  requirements: []
1252
- rubygems_version: 4.0.20
1267
+ rubygems_version: 4.0.23
1253
1268
  specification_version: 4
1254
1269
  summary: The international publication identifier (PubID) library for Ruby.
1255
1270
  test_files: []