pubid 2.0.42 → 2.0.43
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/parg/bsi_pfs.json +1 -1
- data/lib/pubid/bsi_pfs/adopted_base.rb +67 -14
- data/lib/pubid/bsi_pfs/builder.rb +37 -2
- data/lib/pubid/bsi_pfs/identifier.rb +9 -10
- data/lib/pubid/bsi_pfs/identifiers/adopted_european_norm.rb +21 -11
- data/lib/pubid/bsi_pfs/identifiers/adopted_international_standard.rb +21 -11
- data/lib/pubid/bsi_pfs/identifiers/consolidated_identifier.rb +25 -9
- data/lib/pubid/bsi_pfs/identifiers/draft_document.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/publicly_available_specification.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/published_document.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/technical_specification.rb +6 -6
- data/lib/pubid/bsi_pfs/pubid_urn_schema.rb +17 -4
- data/lib/pubid/bsi_pfs/renderer.rb +18 -2
- data/lib/pubid/bsi_pfs/urn_generator.rb +31 -6
- data/lib/pubid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c706e42cf47a3be2877764c84b7dc99b58dcccdd5564c53af60ab48119f6614
|
|
4
|
+
data.tar.gz: d421067efc31aeedfe63a7437d92751c49f358ec08919fe7f8f48e956a381ff9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e846579162aa56c93ce6d332622b25abd2139d637d7d2fc7afb53f7e80e8ef179d2b4fc3786719ed440e94b39cff593536a899b0c8f7c09a67c6b0629420e03d
|
|
7
|
+
data.tar.gz: f3ca75ca1732166a3e4837990aa002af0b82ca0967029124375714e090f16822910e559d9063734dffca64ec9c765510984fa9c6b1be64eba3ea6adcb7a21158
|
data/data/parg/bsi_pfs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"bindings":null,"version":"0.1.0","grammar":"PubidBsiPfs","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":7}},{"Str":{"pattern":"BS"}},{"Str":{"pattern":"PAS"}},{"Str":{"pattern":"PD"}},{"Str":{"pattern":"DD"}},{"Str":{"pattern":"TS"}},{"Alternative":{"atoms":[1,2,3,4,5]}},{"Named":{"name":"publisher","atom":6}},{"Str":{"pattern":" "}},{"Entity":{"atom":66}},{"Str":{"pattern":"EN"}},{"Str":{"pattern":"CEN"}},{"Str":{"pattern":"CLC"}},{"Str":{"pattern":"HD"}},{"Str":{"pattern":"ENV"}},{"Str":{"pattern":"ES"}},{"Str":{"pattern":"CR"}},{"Str":{"pattern":"CWA"}},{"Str":{"pattern":"ISO"}},{"Str":{"pattern":"IEC"}},{"Alternative":{"atoms":[10,11,12,13,14,15,16,17,18,19]}},{"Entity":{"atom":58}},{"Entity":{"atom":42}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":23}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":25}},{"Alternative":{"atoms":[24,26]}},{"Str":{"pattern":"A"}},{"Named":{"name":"supplement_kind","atom":28}},{"Entity":{"atom":34}},{"Entity":{"atom":32}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":31,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement_number","atom":33}},{"Str":{"pattern":":"}},{"Entity":{"atom":39}},{"Entity":{"atom":32}},{"Repetition":{"atom":37,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"supplements_year","atom":38}},{"Sequence":{"atoms":[35,36]}},{"Repetition":{"atom":40,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[27,29,30,41]}},{"Entity":{"atom":56}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":44}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":46}},{"Alternative":{"atoms":[45,47]}},{"Str":{"pattern":"C"}},{"Named":{"name":"supplement_kind","atom":49}},{"Entity":{"atom":34}},{"Str":{"pattern":":"}},{"Entity":{"atom":39}},{"Sequence":{"atoms":[52,53]}},{"Repetition":{"atom":54,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[48,50,51,55]}},{"Alternative":{"atoms":[22,43]}},{"Named":{"name":"supplement","atom":57}},{"Lookahead":{"atom":21,"positive":false}},{"Re":{"pattern":"[\\x01-\\x09]"}},{"Re":{"pattern":"[\\x0b-\\u{10ffff}]"}},{"Alternative":{"atoms":[60,61]}},{"Sequence":{"atoms":[59,62]}},{"Repetition":{"atom":63,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[20,64]}},{"Named":{"name":"adopted","atom":65}},{"Sequence":{"atoms":[0,8,9]}},{"Entity":{"atom":7}},{"Str":{"pattern":" "}},{"Entity":{"atom":76}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":71,"min":1,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":73,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[72,74]}},{"Named":{"name":"number","atom":75}},{"Str":{"pattern":"-"}},{"Entity":{"atom":96}},{"Entity":{"atom":32}},{"Entity":{"atom":83}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Alternative":{"atoms":[81,82]}},{"Alternative":{"atoms":[79,80]}},{"Repetition":{"atom":84,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Str":{"pattern":"-"}},{"Alternative":{"atoms":[86,87]}},{"Entity":{"atom":32}},{"Entity":{"atom":83}},{"Alternative":{"atoms":[89,90]}},{"Repetition":{"atom":91,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[88,92]}},{"Repetition":{"atom":93,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[85,94]}},{"Named":{"name":"part","atom":95}},{"Sequence":{"atoms":[77,78]}},{"Repetition":{"atom":97,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":103}},{"Entity":{"atom":32}},{"Repetition":{"atom":101,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":102}},{"Sequence":{"atoms":[99,100]}},{"Repetition":{"atom":104,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[68,69,70,98,105]}},{"Alternative":{"atoms":[67,106]}},{"Entity":{"atom":111}},{"Entity":{"atom":58}},{"Repetition":{"atom":109,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplements","atom":110}},{"Repetition":{"atom":108,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[107,112]}}],"root":113},"bindings":[{"capture":"publisher","path":"publisher","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"adopted","path":"adopted","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplements[].supplement","type":"raw","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":[]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"BS 10005:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 1016-107.2:1991","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 1344-A1:1960","expect":{}},{"entry":"identifier","kind":"accept","input":"PD 5730","expect":{}},{"entry":"identifier","kind":"accept","input":"PAS 003:1994","expect":{}},{"entry":"identifier","kind":"accept","input":"DD 136-2:1986","expect":{}},{"entry":"identifier","kind":"accept","input":"TS 1:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN 1073-2:2002","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN ISO 105-B06:2020","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 61851-1:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"BS ISO 8601:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"BS IEC 60747-8:2000","expect":{}},{"entry":"identifier","kind":"accept","input":"BS HD 60269-3","expect":{}},{"entry":"identifier","kind":"accept","input":"DD CEN ISO/TS 12180-1:2007","expect":{}},{"entry":"identifier","kind":"accept","input":"DD CLC/TS 50131-2-2:2004","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 60601-1/FRAG1","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 61535/AMD1/FRAG1","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 10125:2014+A1:2016","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN 1005-1:2001+A1:2008","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 646:1958+A2:2013","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"BS","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 1325","expect":{}},{"entry":"identifier","kind":"reject","input":"ISO 9001:2015","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 2X 26:2001","expect":{}},{"entry":"identifier","kind":"reject","input":"DISC PD 0005:1995","expect":{}},{"entry":"identifier","kind":"reject","input":"BS A 103:2025","expect":{}},{"entry":"identifier","kind":"reject","input":"BSI Flex 1886 v2.0:2024-09","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 7671 AMD2","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1000[9]:1971","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1580:Parts 1 and 2:1962","expect":{}},{"entry":"identifier","kind":"reject","input":"BS CISPR 12:1997","expect":{}},{"entry":"identifier","kind":"reject","input":"14/30300822 DC","expect":{}},{"entry":"identifier","kind":"reject","input":"NA to BS EN 1996-1-2:2005","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 7722:2006 BOOK","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 31100:2021 ExComm","expect":{}},{"entry":"identifier","kind":"reject","input":"AMD 11015","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1425:Supplement No. 1:1966","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 185 Index:1962","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 2782-10:Method 1006:1978","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1902-2.3:Addendum No. 1:1976","expect":{}},{"entry":"identifier","kind":"example","input":"BS 10005:1995","expect":{"publisher":"BS","number":"10005","year":"1995"}},{"entry":"identifier","kind":"example","input":"BS 1016-107.2:1991","expect":{"publisher":"BS","number":"1016","part":"107.2","year":"1991"}},{"entry":"identifier","kind":"example","input":"BS 1344-A1:1960","expect":{"publisher":"BS","number":"1344","part":"A1","year":"1960"}},{"entry":"identifier","kind":"example","input":"PD 5730","expect":{"publisher":"PD","number":"5730"}},{"entry":"identifier","kind":"example","input":"PAS 003:1994","expect":{"publisher":"PAS","number":"003","year":"1994"}},{"entry":"identifier","kind":"example","input":"DD 136-2:1986","expect":{"publisher":"DD","number":"136","part":"2","year":"1986"}},{"entry":"identifier","kind":"example","input":"TS 1:1995","expect":{"publisher":"TS","number":"1","year":"1995"}},{"entry":"identifier","kind":"example","input":"BS EN 1073-2:2002","expect":{"publisher":"BS","adopted":"EN 1073-2:2002"}},{"entry":"identifier","kind":"example","input":"BS EN ISO 105-B06:2020","expect":{"publisher":"BS","adopted":"EN ISO 105-B06:2020"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 61851-1:2019","expect":{"publisher":"BS","adopted":"EN IEC 61851-1:2019"}},{"entry":"identifier","kind":"example","input":"BS ISO 8601:2019","expect":{"publisher":"BS","adopted":"ISO 8601:2019"}},{"entry":"identifier","kind":"example","input":"BS IEC 60747-8:2000","expect":{"publisher":"BS","adopted":"IEC 60747-8:2000"}},{"entry":"identifier","kind":"example","input":"BS HD 60269-3","expect":{"publisher":"BS","adopted":"HD 60269-3"}},{"entry":"identifier","kind":"example","input":"DD CEN ISO/TS 12180-1:2007","expect":{"publisher":"DD","adopted":"CEN ISO/TS 12180-1:2007"}},{"entry":"identifier","kind":"example","input":"DD CLC/TS 50131-2-2:2004","expect":{"publisher":"DD","adopted":"CLC/TS 50131-2-2:2004"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 60601-1/FRAG1","expect":{"publisher":"BS","adopted":"EN IEC 60601-1/FRAG1"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 61535/AMD1/FRAG1","expect":{"publisher":"BS","adopted":"EN IEC 61535/AMD1/FRAG1"}},{"entry":"identifier","kind":"example","input":"BS 10125:2014+A1:2016","expect":{"publisher":"BS","number":"10125","year":"2014"}},{"entry":"identifier","kind":"example","input":"BS EN 1005-1:2001+A1:2008","expect":{"publisher":"BS","adopted":"EN 1005-1:2001"}},{"entry":"identifier","kind":"example","input":"BS 646:1958+A2:2013","expect":{"publisher":"BS","number":"646","year":"1958"}}],"docs":{},"source":"# PFS-generated grammar — DO NOT EDIT BY HAND.\n# Source: definitions/bsi.pfs (pfs:1) sha256:acb28ac064cf70b7dcaf8ec199cd535f95c201ca348746f9124ce7d080473585\n# Compiler: pubid/grammar/pfs 0.1.0\n# Flavor key: bsi_pfs (grammar PubidBsiPfs)\n# Regenerate: ruby scripts/pfs compile definitions/bsi.pfs --as bsi_pfs\n# Module: iso.inner v1 (sha256:7a088d2a7814...)\n# Module: iec.inner v1 (sha256:b9002f5d106b...)\n# Module: en.overlay v1 (sha256:b92ac2b27544...)\n# Module: national.prefix v1 (sha256:c7aa2f2442e8...)\n# Module: supplements.core v1 (sha256:9fa9656375c7...)\n\ngrammar PubidBsiPfs version \"0.1.0\" edition 2 {\n\n # Grammar fragments: named lexical terms declared under `grammar:`.\n iso_space = \" \"\n iso_colon = \":\"\n iso_dash = \"-\"\n iso_year = 4*digit\n iso_part = 1*digit [\"-\" 1*digit]\n iso_number = 1*(\"0\" %x31-39) as iso_zero_lead *digit [iso_dash iso_part]\n iso_document = \"ISO\" iso_space iso_number [iso_colon iso_year]\n iec_space = \" \"\n iec_colon = \":\"\n iec_dash = \"-\"\n iec_year = 4*digit\n iec_part = 1*digit\n iec_number = ((\"6\" 4*digit / 5*digit / 1*digit)) as iec_number_core [iec_dash iec_part]\n iec_document = \"IEC\" iec_space iec_number [iec_colon iec_year]\n en_space = \" \"\n en_draft = (\"pr\" / \"Fpr\") as en_draft_kind\n en_face = [en_draft] \"EN\"\n en_adoption = en_face en_space iso_document\n supplement_number = 1*digit\n supplement_year = 4*digit\n supplement_month = 2*digit\n digit = %x30-39\n alpha = %x41-5A / %x61-7A\n\n # Fields: one capture rule per declared field; the whole pattern\n # is the capture.\n bsi_publisher = ((\"BS\" / \"PAS\" / \"PD\" / \"DD\" / \"TS\")) as publisher\n bsi_number = (1*(%x30-39) [%x41-5A]) as number\n bsi_part = (1*(digit / alpha) *((\".\" / \"-\") 1*(digit / alpha))) as part\n bsi_year = (4digit) as year\n bsi_adopted = (( ( \"EN\" / \"CEN\" / \"CLC\" / \"HD\" / \"ENV\" / \"ES\" / \"CR\" / \"CWA\" / \"ISO\" / \"IEC\" ) ( *( !(bsi_supplement) ( %x01-09 / %x0B-10FFFF ) ) ) )) as adopted\n\n # Supplement run (compiled from the supplements declaration):\n # each item binds its separator, kind face, ordinal and date\n # columns; the builder folds the run into the declared wrapper\n # classes (the slash run standalone, the plus run consolidated).\n bsi_supplement_number = (1*digit) as supplement_number\n bsi_supplements_year = (4digit) as supplements_year\n bsi_supplement_amendment = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"A\" as supplement_kind bsi_supplement_number [\":\" bsi_supplements_year]\n }\n bsi_supplement_corrigendum = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"C\" as supplement_kind bsi_supplement_number [\":\" bsi_supplements_year]\n }\n bsi_supplement = ( bsi_supplement_amendment / bsi_supplement_corrigendum ) as supplement\n bsi_supplements = (1*bsi_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 = ( bsi_publisher \" \" bsi_adopted / bsi_publisher \" \" bsi_number [\"-\" bsi_part] [\":\" bsi_year] ) [bsi_supplements]\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 publisher -> publisher (string)\n number -> number (string)\n part -> part (string)\n year -> year (string)\n adopted -> adopted (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 \"BS 10005:1995\"\n accept \"BS 1016-107.2:1991\"\n accept \"BS 1344-A1:1960\"\n accept \"PD 5730\"\n accept \"PAS 003:1994\"\n accept \"DD 136-2:1986\"\n accept \"TS 1:1995\"\n accept \"BS EN 1073-2:2002\"\n accept \"BS EN ISO 105-B06:2020\"\n accept \"BS EN IEC 61851-1:2019\"\n accept \"BS ISO 8601:2019\"\n accept \"BS IEC 60747-8:2000\"\n accept \"BS HD 60269-3\"\n accept \"DD CEN ISO/TS 12180-1:2007\"\n accept \"DD CLC/TS 50131-2-2:2004\"\n accept \"BS EN IEC 60601-1/FRAG1\"\n accept \"BS EN IEC 61535/AMD1/FRAG1\"\n accept \"BS 10125:2014+A1:2016\"\n accept \"BS EN 1005-1:2001+A1:2008\"\n accept \"BS 646:1958+A2:2013\"\n reject \"nonsense\"\n reject \"BS\"\n reject \"EN 1325\"\n reject \"ISO 9001:2015\"\n reject \"BS 2X 26:2001\"\n reject \"DISC PD 0005:1995\"\n reject \"BS A 103:2025\"\n reject \"BSI Flex 1886 v2.0:2024-09\"\n reject \"BS 7671 AMD2\"\n reject \"BS 1000[9]:1971\"\n reject \"BS 1580:Parts 1 and 2:1962\"\n reject \"BS CISPR 12:1997\"\n reject \"14/30300822 DC\"\n reject \"NA to BS EN 1996-1-2:2005\"\n reject \"BS 7722:2006 BOOK\"\n reject \"BS 31100:2021 ExComm\"\n reject \"AMD 11015\"\n reject \"BS 1425:Supplement No. 1:1966\"\n reject \"BS 185 Index:1962\"\n reject \"BS 2782-10:Method 1006:1978\"\n reject \"BS 1902-2.3:Addendum No. 1:1976\"\n example \"BS 10005:1995\" { publisher: \"BS\" number: \"10005\" year: \"1995\" }\n example \"BS 1016-107.2:1991\" { publisher: \"BS\" number: \"1016\" part: \"107.2\" year: \"1991\" }\n example \"BS 1344-A1:1960\" { publisher: \"BS\" number: \"1344\" part: \"A1\" year: \"1960\" }\n example \"PD 5730\" { publisher: \"PD\" number: \"5730\" }\n example \"PAS 003:1994\" { publisher: \"PAS\" number: \"003\" year: \"1994\" }\n example \"DD 136-2:1986\" { publisher: \"DD\" number: \"136\" part: \"2\" year: \"1986\" }\n example \"TS 1:1995\" { publisher: \"TS\" number: \"1\" year: \"1995\" }\n example \"BS EN 1073-2:2002\" { publisher: \"BS\" adopted: \"EN 1073-2:2002\" }\n example \"BS EN ISO 105-B06:2020\" { publisher: \"BS\" adopted: \"EN ISO 105-B06:2020\" }\n example \"BS EN IEC 61851-1:2019\" { publisher: \"BS\" adopted: \"EN IEC 61851-1:2019\" }\n example \"BS ISO 8601:2019\" { publisher: \"BS\" adopted: \"ISO 8601:2019\" }\n example \"BS IEC 60747-8:2000\" { publisher: \"BS\" adopted: \"IEC 60747-8:2000\" }\n example \"BS HD 60269-3\" { publisher: \"BS\" adopted: \"HD 60269-3\" }\n example \"DD CEN ISO/TS 12180-1:2007\" { publisher: \"DD\" adopted: \"CEN ISO/TS 12180-1:2007\" }\n example \"DD CLC/TS 50131-2-2:2004\" { publisher: \"DD\" adopted: \"CLC/TS 50131-2-2:2004\" }\n example \"BS EN IEC 60601-1/FRAG1\" { publisher: \"BS\" adopted: \"EN IEC 60601-1/FRAG1\" }\n example \"BS EN IEC 61535/AMD1/FRAG1\" { publisher: \"BS\" adopted: \"EN IEC 61535/AMD1/FRAG1\" }\n example \"BS 10125:2014+A1:2016\" { publisher: \"BS\" number: \"10125\" year: \"2014\" }\n example \"BS EN 1005-1:2001+A1:2008\" { publisher: \"BS\" adopted: \"EN 1005-1:2001\" }\n example \"BS 646:1958+A2:2013\" { publisher: \"BS\" number: \"646\" year: \"1958\" }\n }\n}\n","source_hash":"5a9bd671fb9193d1b1b5b8df1284fe1ecf5fdf40ea2514b5fc10d5c4da3473a3","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:ff4f7c71d1477155a9534c68abb01b36917ce6f7473818342999488a85af2eb5","checksum":"sha256:49113b4674e5a7bf6a07d413a1635d6343fe5af1697c9da7715dac3ff39de5ba","validated":{"lint_errors":0,"lint_warnings":0,"tests_total":61,"tests_failures":0,"self_test":true}}
|
|
1
|
+
{"bindings":null,"version":"0.1.0","grammar":"PubidBsiPfs","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":7}},{"Str":{"pattern":"BS"}},{"Str":{"pattern":"PAS"}},{"Str":{"pattern":"PD"}},{"Str":{"pattern":"DD"}},{"Str":{"pattern":"TS"}},{"Alternative":{"atoms":[1,2,3,4,5]}},{"Named":{"name":"publisher","atom":6}},{"Str":{"pattern":" "}},{"Entity":{"atom":66}},{"Str":{"pattern":"EN"}},{"Str":{"pattern":"CEN"}},{"Str":{"pattern":"CLC"}},{"Str":{"pattern":"HD"}},{"Str":{"pattern":"ENV"}},{"Str":{"pattern":"ES"}},{"Str":{"pattern":"CR"}},{"Str":{"pattern":"CWA"}},{"Str":{"pattern":"ISO"}},{"Str":{"pattern":"IEC"}},{"Alternative":{"atoms":[10,11,12,13,14,15,16,17,18,19]}},{"Entity":{"atom":58}},{"Entity":{"atom":42}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":23}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":25}},{"Alternative":{"atoms":[24,26]}},{"Str":{"pattern":"A"}},{"Named":{"name":"supplement_kind","atom":28}},{"Entity":{"atom":34}},{"Entity":{"atom":32}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":31,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement_number","atom":33}},{"Str":{"pattern":":"}},{"Entity":{"atom":39}},{"Entity":{"atom":32}},{"Repetition":{"atom":37,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"supplements_year","atom":38}},{"Sequence":{"atoms":[35,36]}},{"Repetition":{"atom":40,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[27,29,30,41]}},{"Entity":{"atom":56}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":44}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":46}},{"Alternative":{"atoms":[45,47]}},{"Str":{"pattern":"C"}},{"Named":{"name":"supplement_kind","atom":49}},{"Entity":{"atom":34}},{"Str":{"pattern":":"}},{"Entity":{"atom":39}},{"Sequence":{"atoms":[52,53]}},{"Repetition":{"atom":54,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[48,50,51,55]}},{"Alternative":{"atoms":[22,43]}},{"Named":{"name":"supplement","atom":57}},{"Lookahead":{"atom":21,"positive":false}},{"Re":{"pattern":"[\\x01-\\x09]"}},{"Re":{"pattern":"[\\x0b-\\u{10ffff}]"}},{"Alternative":{"atoms":[60,61]}},{"Sequence":{"atoms":[59,62]}},{"Repetition":{"atom":63,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[20,64]}},{"Named":{"name":"adopted","atom":65}},{"Sequence":{"atoms":[0,8,9]}},{"Entity":{"atom":7}},{"Str":{"pattern":" "}},{"Entity":{"atom":76}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":71,"min":1,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":73,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[72,74]}},{"Named":{"name":"number","atom":75}},{"Str":{"pattern":"-"}},{"Entity":{"atom":96}},{"Entity":{"atom":32}},{"Entity":{"atom":83}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Alternative":{"atoms":[81,82]}},{"Alternative":{"atoms":[79,80]}},{"Repetition":{"atom":84,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Str":{"pattern":"-"}},{"Alternative":{"atoms":[86,87]}},{"Entity":{"atom":32}},{"Entity":{"atom":83}},{"Alternative":{"atoms":[89,90]}},{"Repetition":{"atom":91,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[88,92]}},{"Repetition":{"atom":93,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[85,94]}},{"Named":{"name":"part","atom":95}},{"Sequence":{"atoms":[77,78]}},{"Repetition":{"atom":97,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":103}},{"Entity":{"atom":32}},{"Repetition":{"atom":101,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":102}},{"Sequence":{"atoms":[99,100]}},{"Repetition":{"atom":104,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[68,69,70,98,105]}},{"Alternative":{"atoms":[67,106]}},{"Entity":{"atom":111}},{"Entity":{"atom":58}},{"Repetition":{"atom":109,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplements","atom":110}},{"Repetition":{"atom":108,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[107,112]}}],"root":113},"bindings":[{"capture":"publisher","path":"publisher","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"adopted","path":"adopted","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplements[].supplement","type":"raw","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":[]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"BS 10005:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 1016-107.2:1991","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 1344-A1:1960","expect":{}},{"entry":"identifier","kind":"accept","input":"PD 5730","expect":{}},{"entry":"identifier","kind":"accept","input":"PAS 003:1994","expect":{}},{"entry":"identifier","kind":"accept","input":"DD 136-2:1986","expect":{}},{"entry":"identifier","kind":"accept","input":"TS 1:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN 1073-2:2002","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN ISO 105-B06:2020","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 61851-1:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"BS ISO 8601:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"BS IEC 60747-8:2000","expect":{}},{"entry":"identifier","kind":"accept","input":"BS HD 60269-3","expect":{}},{"entry":"identifier","kind":"accept","input":"DD CEN ISO/TS 12180-1:2007","expect":{}},{"entry":"identifier","kind":"accept","input":"DD CLC/TS 50131-2-2:2004","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 60601-1/FRAG1","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 61535/AMD1/FRAG1","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 10125:2014+A1:2016","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN 1005-1:2001+A1:2008","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 646:1958+A2:2013","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"BS","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 1325","expect":{}},{"entry":"identifier","kind":"reject","input":"ISO 9001:2015","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 2X 26:2001","expect":{}},{"entry":"identifier","kind":"reject","input":"DISC PD 0005:1995","expect":{}},{"entry":"identifier","kind":"reject","input":"BS A 103:2025","expect":{}},{"entry":"identifier","kind":"reject","input":"BSI Flex 1886 v2.0:2024-09","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 7671 AMD2","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1000[9]:1971","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1580:Parts 1 and 2:1962","expect":{}},{"entry":"identifier","kind":"reject","input":"BS CISPR 12:1997","expect":{}},{"entry":"identifier","kind":"reject","input":"14/30300822 DC","expect":{}},{"entry":"identifier","kind":"reject","input":"NA to BS EN 1996-1-2:2005","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 7722:2006 BOOK","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 31100:2021 ExComm","expect":{}},{"entry":"identifier","kind":"reject","input":"AMD 11015","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1425:Supplement No. 1:1966","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 185 Index:1962","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 2782-10:Method 1006:1978","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1902-2.3:Addendum No. 1:1976","expect":{}},{"entry":"identifier","kind":"example","input":"BS 10005:1995","expect":{"publisher":"BS","number":"10005","year":"1995"}},{"entry":"identifier","kind":"example","input":"BS 1016-107.2:1991","expect":{"publisher":"BS","number":"1016","part":"107.2","year":"1991"}},{"entry":"identifier","kind":"example","input":"BS 1344-A1:1960","expect":{"publisher":"BS","number":"1344","part":"A1","year":"1960"}},{"entry":"identifier","kind":"example","input":"PD 5730","expect":{"publisher":"PD","number":"5730"}},{"entry":"identifier","kind":"example","input":"PAS 003:1994","expect":{"publisher":"PAS","number":"003","year":"1994"}},{"entry":"identifier","kind":"example","input":"DD 136-2:1986","expect":{"publisher":"DD","number":"136","part":"2","year":"1986"}},{"entry":"identifier","kind":"example","input":"TS 1:1995","expect":{"publisher":"TS","number":"1","year":"1995"}},{"entry":"identifier","kind":"example","input":"BS EN 1073-2:2002","expect":{"publisher":"BS","adopted":"EN 1073-2:2002"}},{"entry":"identifier","kind":"example","input":"BS EN ISO 105-B06:2020","expect":{"publisher":"BS","adopted":"EN ISO 105-B06:2020"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 61851-1:2019","expect":{"publisher":"BS","adopted":"EN IEC 61851-1:2019"}},{"entry":"identifier","kind":"example","input":"BS ISO 8601:2019","expect":{"publisher":"BS","adopted":"ISO 8601:2019"}},{"entry":"identifier","kind":"example","input":"BS IEC 60747-8:2000","expect":{"publisher":"BS","adopted":"IEC 60747-8:2000"}},{"entry":"identifier","kind":"example","input":"BS HD 60269-3","expect":{"publisher":"BS","adopted":"HD 60269-3"}},{"entry":"identifier","kind":"example","input":"DD CEN ISO/TS 12180-1:2007","expect":{"publisher":"DD","adopted":"CEN ISO/TS 12180-1:2007"}},{"entry":"identifier","kind":"example","input":"DD CLC/TS 50131-2-2:2004","expect":{"publisher":"DD","adopted":"CLC/TS 50131-2-2:2004"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 60601-1/FRAG1","expect":{"publisher":"BS","adopted":"EN IEC 60601-1/FRAG1"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 61535/AMD1/FRAG1","expect":{"publisher":"BS","adopted":"EN IEC 61535/AMD1/FRAG1"}},{"entry":"identifier","kind":"example","input":"BS 10125:2014+A1:2016","expect":{"publisher":"BS","number":"10125","year":"2014"}},{"entry":"identifier","kind":"example","input":"BS EN 1005-1:2001+A1:2008","expect":{"publisher":"BS","adopted":"EN 1005-1:2001"}},{"entry":"identifier","kind":"example","input":"BS 646:1958+A2:2013","expect":{"publisher":"BS","number":"646","year":"1958"}}],"docs":{},"source":"# PFS-generated grammar — DO NOT EDIT BY HAND.\n# Source: definitions/bsi.pfs (pfs:1) sha256:e16c91365a12ffa75c8645ce69774e04f808d85d531b1c2c3c0f75f614197cf8\n# Compiler: pubid/grammar/pfs 0.1.0\n# Flavor key: bsi_pfs (grammar PubidBsiPfs)\n# Regenerate: ruby scripts/pfs compile definitions/bsi.pfs --as bsi_pfs\n# Module: iso.inner v1 (sha256:7a088d2a7814...)\n# Module: iec.inner v1 (sha256:b9002f5d106b...)\n# Module: en.overlay v1 (sha256:b92ac2b27544...)\n# Module: national.prefix v1 (sha256:c7aa2f2442e8...)\n# Module: supplements.core v1 (sha256:9fa9656375c7...)\n\ngrammar PubidBsiPfs version \"0.1.0\" edition 2 {\n\n # Grammar fragments: named lexical terms declared under `grammar:`.\n iso_space = \" \"\n iso_colon = \":\"\n iso_dash = \"-\"\n iso_year = 4*digit\n iso_part = 1*digit [\"-\" 1*digit]\n iso_number = 1*(\"0\" %x31-39) as iso_zero_lead *digit [iso_dash iso_part]\n iso_document = \"ISO\" iso_space iso_number [iso_colon iso_year]\n iec_space = \" \"\n iec_colon = \":\"\n iec_dash = \"-\"\n iec_year = 4*digit\n iec_part = 1*digit\n iec_number = ((\"6\" 4*digit / 5*digit / 1*digit)) as iec_number_core [iec_dash iec_part]\n iec_document = \"IEC\" iec_space iec_number [iec_colon iec_year]\n en_space = \" \"\n en_draft = (\"pr\" / \"Fpr\") as en_draft_kind\n en_face = [en_draft] \"EN\"\n en_adoption = en_face en_space iso_document\n supplement_number = 1*digit\n supplement_year = 4*digit\n supplement_month = 2*digit\n digit = %x30-39\n alpha = %x41-5A / %x61-7A\n\n # Fields: one capture rule per declared field; the whole pattern\n # is the capture.\n bsi_publisher = ((\"BS\" / \"PAS\" / \"PD\" / \"DD\" / \"TS\")) as publisher\n bsi_number = (1*(%x30-39) [%x41-5A]) as number\n bsi_part = (1*(digit / alpha) *((\".\" / \"-\") 1*(digit / alpha))) as part\n bsi_year = (4digit) as year\n bsi_adopted = (( ( \"EN\" / \"CEN\" / \"CLC\" / \"HD\" / \"ENV\" / \"ES\" / \"CR\" / \"CWA\" / \"ISO\" / \"IEC\" ) ( *( !(bsi_supplement) ( %x01-09 / %x0B-10FFFF ) ) ) )) as adopted\n\n # Supplement run (compiled from the supplements declaration):\n # each item binds its separator, kind face, ordinal and date\n # columns; the builder folds the run into the declared wrapper\n # classes (the slash run standalone, the plus run consolidated).\n bsi_supplement_number = (1*digit) as supplement_number\n bsi_supplements_year = (4digit) as supplements_year\n bsi_supplement_amendment = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"A\" as supplement_kind bsi_supplement_number [\":\" bsi_supplements_year]\n }\n bsi_supplement_corrigendum = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"C\" as supplement_kind bsi_supplement_number [\":\" bsi_supplements_year]\n }\n bsi_supplement = ( bsi_supplement_amendment / bsi_supplement_corrigendum ) as supplement\n bsi_supplements = (1*bsi_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 = ( bsi_publisher \" \" bsi_adopted / bsi_publisher \" \" bsi_number [\"-\" bsi_part] [\":\" bsi_year] ) [bsi_supplements]\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 publisher -> publisher (string)\n number -> number (string)\n part -> part (string)\n year -> year (string)\n adopted -> adopted (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 \"BS 10005:1995\"\n accept \"BS 1016-107.2:1991\"\n accept \"BS 1344-A1:1960\"\n accept \"PD 5730\"\n accept \"PAS 003:1994\"\n accept \"DD 136-2:1986\"\n accept \"TS 1:1995\"\n accept \"BS EN 1073-2:2002\"\n accept \"BS EN ISO 105-B06:2020\"\n accept \"BS EN IEC 61851-1:2019\"\n accept \"BS ISO 8601:2019\"\n accept \"BS IEC 60747-8:2000\"\n accept \"BS HD 60269-3\"\n accept \"DD CEN ISO/TS 12180-1:2007\"\n accept \"DD CLC/TS 50131-2-2:2004\"\n accept \"BS EN IEC 60601-1/FRAG1\"\n accept \"BS EN IEC 61535/AMD1/FRAG1\"\n accept \"BS 10125:2014+A1:2016\"\n accept \"BS EN 1005-1:2001+A1:2008\"\n accept \"BS 646:1958+A2:2013\"\n reject \"nonsense\"\n reject \"BS\"\n reject \"EN 1325\"\n reject \"ISO 9001:2015\"\n reject \"BS 2X 26:2001\"\n reject \"DISC PD 0005:1995\"\n reject \"BS A 103:2025\"\n reject \"BSI Flex 1886 v2.0:2024-09\"\n reject \"BS 7671 AMD2\"\n reject \"BS 1000[9]:1971\"\n reject \"BS 1580:Parts 1 and 2:1962\"\n reject \"BS CISPR 12:1997\"\n reject \"14/30300822 DC\"\n reject \"NA to BS EN 1996-1-2:2005\"\n reject \"BS 7722:2006 BOOK\"\n reject \"BS 31100:2021 ExComm\"\n reject \"AMD 11015\"\n reject \"BS 1425:Supplement No. 1:1966\"\n reject \"BS 185 Index:1962\"\n reject \"BS 2782-10:Method 1006:1978\"\n reject \"BS 1902-2.3:Addendum No. 1:1976\"\n example \"BS 10005:1995\" { publisher: \"BS\" number: \"10005\" year: \"1995\" }\n example \"BS 1016-107.2:1991\" { publisher: \"BS\" number: \"1016\" part: \"107.2\" year: \"1991\" }\n example \"BS 1344-A1:1960\" { publisher: \"BS\" number: \"1344\" part: \"A1\" year: \"1960\" }\n example \"PD 5730\" { publisher: \"PD\" number: \"5730\" }\n example \"PAS 003:1994\" { publisher: \"PAS\" number: \"003\" year: \"1994\" }\n example \"DD 136-2:1986\" { publisher: \"DD\" number: \"136\" part: \"2\" year: \"1986\" }\n example \"TS 1:1995\" { publisher: \"TS\" number: \"1\" year: \"1995\" }\n example \"BS EN 1073-2:2002\" { publisher: \"BS\" adopted: \"EN 1073-2:2002\" }\n example \"BS EN ISO 105-B06:2020\" { publisher: \"BS\" adopted: \"EN ISO 105-B06:2020\" }\n example \"BS EN IEC 61851-1:2019\" { publisher: \"BS\" adopted: \"EN IEC 61851-1:2019\" }\n example \"BS ISO 8601:2019\" { publisher: \"BS\" adopted: \"ISO 8601:2019\" }\n example \"BS IEC 60747-8:2000\" { publisher: \"BS\" adopted: \"IEC 60747-8:2000\" }\n example \"BS HD 60269-3\" { publisher: \"BS\" adopted: \"HD 60269-3\" }\n example \"DD CEN ISO/TS 12180-1:2007\" { publisher: \"DD\" adopted: \"CEN ISO/TS 12180-1:2007\" }\n example \"DD CLC/TS 50131-2-2:2004\" { publisher: \"DD\" adopted: \"CLC/TS 50131-2-2:2004\" }\n example \"BS EN IEC 60601-1/FRAG1\" { publisher: \"BS\" adopted: \"EN IEC 60601-1/FRAG1\" }\n example \"BS EN IEC 61535/AMD1/FRAG1\" { publisher: \"BS\" adopted: \"EN IEC 61535/AMD1/FRAG1\" }\n example \"BS 10125:2014+A1:2016\" { publisher: \"BS\" number: \"10125\" year: \"2014\" }\n example \"BS EN 1005-1:2001+A1:2008\" { publisher: \"BS\" adopted: \"EN 1005-1:2001\" }\n example \"BS 646:1958+A2:2013\" { publisher: \"BS\" number: \"646\" year: \"1958\" }\n }\n}\n","source_hash":"83631d43804920c9ef782eee3731a411bd60bc8dd63a4e5248be6f9a87fb01cd","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:f327b757c2ee8eede07056ba3f564caa81ea3332f9913285c86ca22001c46d06","checksum":"sha256:71f1a18a597a6601bf1b454514dcda1cfa40a2cb63506976d03082730bf559ae","validated":{"lint_errors":0,"lint_warnings":0,"tests_total":61,"tests_failures":0,"self_test":true}}
|
|
@@ -17,6 +17,13 @@ module Pubid
|
|
|
17
17
|
# chains — "BS EN ISO 105-B06:2020" is this wrapper over a CEN
|
|
18
18
|
# adoption over the ISO document); anything else is the adopted
|
|
19
19
|
# international standard (BS ISO …, BS IEC …);
|
|
20
|
+
# * the adopted document lands on the builder's declared
|
|
21
|
+
# ADOPTED_ATTRIBUTE — the uniform `base` (the codec's root-first
|
|
22
|
+
# walk, the from_hash key and the MR join read it);
|
|
23
|
+
# * the wrapper's own glued edition face (the declared
|
|
24
|
+
# ADOPTED_EDITION_FACE, "BS HD IEC 60364-8-81 ED1") lifts out of
|
|
25
|
+
# the run BEFORE the delegation — the owning flavor drops it, the
|
|
26
|
+
# wrapper column carries it (the coded builder's own extraction);
|
|
20
27
|
# * a run no flavor owns, or a run the owning flavor rejects, is a
|
|
21
28
|
# REJECTION (Pubid::Errors::ParseError) — never a silently empty
|
|
22
29
|
# wrapper (the parse-failure contract's nil/raise rule).
|
|
@@ -29,20 +36,12 @@ module Pubid
|
|
|
29
36
|
# The adoption identifier the captured run builds. Raises when the
|
|
30
37
|
# run names no known flavor or the owning flavor rejects it.
|
|
31
38
|
def build(builder, data)
|
|
32
|
-
adopted_str = builder
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"an adopted run captured no document (#{builder.flavor_name})"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
adopted_id = parse_adopted(adopted_str)
|
|
39
|
-
publisher = builder.unwrap(data[:publisher])&.to_s
|
|
40
|
-
|
|
41
|
-
attrs = { adopted: adopted_id }
|
|
42
|
-
attrs[:publisher] =
|
|
43
|
-
::Pubid::Components::Publisher.new(body: publisher) if publisher
|
|
39
|
+
adopted_str = captured_run(builder, data)
|
|
40
|
+
run, edition = extract_edition(builder, adopted_str)
|
|
41
|
+
adopted_id = parse_adopted(run)
|
|
44
42
|
|
|
45
|
-
wrapper_class(adopted_id).new(**
|
|
43
|
+
wrapper_class(adopted_id).new(**wrapper_attrs(builder, data,
|
|
44
|
+
adopted_id, edition))
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
# The implicit probe: BSI carries none — the coded builder's
|
|
@@ -55,6 +54,60 @@ module Pubid
|
|
|
55
54
|
|
|
56
55
|
private
|
|
57
56
|
|
|
57
|
+
# The captured run, stripped — or the rejection (the parse-failure
|
|
58
|
+
# contract's nil/raise rule: an adopted run that captured no
|
|
59
|
+
# document never builds a silently empty wrapper).
|
|
60
|
+
def captured_run(builder, data)
|
|
61
|
+
adopted_str = builder.unwrap(data[:adopted])&.to_s&.strip
|
|
62
|
+
if adopted_str.nil? || adopted_str.empty?
|
|
63
|
+
raise ::Pubid::Errors::ParseError,
|
|
64
|
+
"an adopted run captured no document (#{builder.flavor_name})"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
adopted_str
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# The wrapper's attributes: the adopted document under the
|
|
71
|
+
# builder's declared model column, the captured head token as the
|
|
72
|
+
# publisher, and the lifted edition face when the run carried one.
|
|
73
|
+
def wrapper_attrs(builder, data, adopted_id, edition)
|
|
74
|
+
attrs = { adopted_attribute(builder) => adopted_id }
|
|
75
|
+
publisher = builder.unwrap(data[:publisher])&.to_s
|
|
76
|
+
if publisher
|
|
77
|
+
attrs[:publisher] =
|
|
78
|
+
::Pubid::Components::Publisher.new(body: publisher)
|
|
79
|
+
end
|
|
80
|
+
attrs[:edition] = edition if edition
|
|
81
|
+
attrs
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# The wrapper's model column for the adopted document, from the
|
|
85
|
+
# generated builder's declaration (the capture name when it
|
|
86
|
+
# declares none — the legacy slot).
|
|
87
|
+
def adopted_attribute(builder)
|
|
88
|
+
if builder.class.const_defined?(:ADOPTED_ATTRIBUTE)
|
|
89
|
+
builder.class::ADOPTED_ATTRIBUTE.to_sym
|
|
90
|
+
else
|
|
91
|
+
:adopted
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# The declared glued edition face, lifted from the run's tail
|
|
96
|
+
# ("BS HD IEC 60364-8-81 ED1" — the ordinal glues to the face,
|
|
97
|
+
# there is no edition_space). Returns the cleaned run and the
|
|
98
|
+
# ordinal; a run with no face passes through untouched.
|
|
99
|
+
def extract_edition(builder, adopted_str)
|
|
100
|
+
unless builder.class.const_defined?(:ADOPTED_EDITION_FACE)
|
|
101
|
+
return [adopted_str, nil]
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
face = builder.class::ADOPTED_EDITION_FACE
|
|
105
|
+
match = adopted_str.match(/\s+#{face}(\d+)\s*\z/)
|
|
106
|
+
return [adopted_str, nil] unless match
|
|
107
|
+
|
|
108
|
+
[adopted_str.sub(/\s+#{face}#{match[1]}\s*\z/, ""), match[1]]
|
|
109
|
+
end
|
|
110
|
+
|
|
58
111
|
# The wrapper class by what the owning flavor came back with: a
|
|
59
112
|
# CEN identifier (including a CEN adoption of an ISO/IEC document)
|
|
60
113
|
# is the adopted European norm; an ISO/IEC identifier is the
|
|
@@ -77,7 +130,7 @@ module Pubid
|
|
|
77
130
|
klass = dispatch(lead)
|
|
78
131
|
if klass.nil?
|
|
79
132
|
raise ::Pubid::Errors::ParseError,
|
|
80
|
-
"no owning flavor parses the
|
|
133
|
+
"no owning flavor parses the run #{adopted_str.inspect}"
|
|
81
134
|
end
|
|
82
135
|
|
|
83
136
|
klass.parse(adopted_str)
|
|
@@ -23,6 +23,23 @@ module Pubid
|
|
|
23
23
|
|
|
24
24
|
}.freeze
|
|
25
25
|
|
|
26
|
+
# The designation trios (the typed trio's declaration): the
|
|
27
|
+
# token that selected the class is the designation face, not
|
|
28
|
+
# a publisher — the column keeps the class default and the
|
|
29
|
+
# identifier carries the stage entry's type/stage/typed_stage
|
|
30
|
+
# (the coded builder's cast).
|
|
31
|
+
DESIGNATION_STAGES = {
|
|
32
|
+
"PAS" => { code: "pubpas", stage_code: "published", type_code: "pas", abbr: ["PAS"], name: "Publicly Available Specification", harmonized_stages: ["60.00", "60.60"] },
|
|
33
|
+
"PD" => { code: "pubpd", stage_code: "published", type_code: "pd", abbr: ["PD"], name: "Published Document", harmonized_stages: ["60.00", "60.60"] },
|
|
34
|
+
"DD" => { code: "pubdd", stage_code: "published", type_code: "dd", abbr: ["DD"], name: "Draft Document", harmonized_stages: ["60.00", "60.60"] },
|
|
35
|
+
"TS" => { code: "pubts", stage_code: "published", type_code: "ts", abbr: ["TS"], name: "Technical Specification", harmonized_stages: ["60.00", "60.60"] },
|
|
36
|
+
}.freeze
|
|
37
|
+
|
|
38
|
+
# The model column the adopted document lands on (the vendored
|
|
39
|
+
# hook's wrapper slot) and the declared edition face, if any.
|
|
40
|
+
ADOPTED_ATTRIBUTE = "base"
|
|
41
|
+
ADOPTED_EDITION_FACE = "ED"
|
|
42
|
+
|
|
26
43
|
def self.build(parsed_data)
|
|
27
44
|
new.build(parsed_data)
|
|
28
45
|
end
|
|
@@ -78,7 +95,9 @@ module Pubid
|
|
|
78
95
|
identifier.number = data[:number]&.to_s
|
|
79
96
|
identifier.part = data[:part]&.to_s
|
|
80
97
|
identifier.version = present_string(data[:version])
|
|
81
|
-
|
|
98
|
+
# A designation token selects the class but is not a publisher:
|
|
99
|
+
# the column keeps the class default (the organization's).
|
|
100
|
+
if data[:publisher] && !DESIGNATION_STAGES.key?(data[:publisher].to_s)
|
|
82
101
|
identifier.publisher = ::Pubid::Components::Publisher.new(body: data[:publisher].to_s)
|
|
83
102
|
end
|
|
84
103
|
copubs = Array(data[:copublishers]).map do |row|
|
|
@@ -88,6 +107,19 @@ module Pubid
|
|
|
88
107
|
identifier.copublishers = copubs unless copubs.empty?
|
|
89
108
|
type_token = data[:guide] || data[:type]
|
|
90
109
|
identifier.type = ::Pubid::Components::Type.new(abbr: type_token.to_s) if type_token
|
|
110
|
+
# The typed trio (the designation's stage entry): type, stage
|
|
111
|
+
# and typed_stage carry the registry row — the wire keys the
|
|
112
|
+
# coded flavor serializes.
|
|
113
|
+
if (row = DESIGNATION_STAGES[data[:publisher].to_s])
|
|
114
|
+
typed_stage = ::Pubid::Components::TypedStage.new(
|
|
115
|
+
code: row[:code], stage_code: row[:stage_code],
|
|
116
|
+
type_code: row[:type_code], abbr: row[:abbr],
|
|
117
|
+
name: row[:name], harmonized_stages: row[:harmonized_stages],
|
|
118
|
+
)
|
|
119
|
+
identifier.typed_stage = typed_stage
|
|
120
|
+
identifier.type = typed_stage.to_type
|
|
121
|
+
identifier.stage = typed_stage.to_stage
|
|
122
|
+
end
|
|
91
123
|
captured = data[:stage]
|
|
92
124
|
return unless captured
|
|
93
125
|
|
|
@@ -131,7 +163,10 @@ module Pubid
|
|
|
131
163
|
inner
|
|
132
164
|
end
|
|
133
165
|
if items.any? { |item| item[:supplements_plus] || item["supplements_plus"] }
|
|
134
|
-
|
|
166
|
+
# The declared marker-less bundle (the coded-BSI shape): each
|
|
167
|
+
# member amends THE bundle's base document, so the members
|
|
168
|
+
# carry it (the coded builder's wrap_with_consolidated).
|
|
169
|
+
members = items.map { |item| supplement_from(item, base: base) }
|
|
135
170
|
Identifiers::ConsolidatedIdentifier.new(identifiers: [base] + members)
|
|
136
171
|
else
|
|
137
172
|
supplement_from(items.first, base: base)
|
|
@@ -27,16 +27,11 @@ module Pubid
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def self.flat_scalar_fields
|
|
37
|
-
super.merge(publisher: :body, copublishers: :body)
|
|
38
|
-
end
|
|
39
|
-
|
|
30
|
+
# The publisher and copublishers keep the lutaml
|
|
31
|
+
# component shapes ({"body" => "DD"} — the coded
|
|
32
|
+
# flavor's own wire form): the definition's
|
|
33
|
+
# serialization declaration declines the flat-scalar
|
|
34
|
+
# table.
|
|
40
35
|
# The declared draft stages: the serialized code is the key,
|
|
41
36
|
# the official-URN code the declared `urn:` value.
|
|
42
37
|
STAGE_CODES = {
|
|
@@ -46,9 +41,13 @@ module Pubid
|
|
|
46
41
|
# A draft stage serializes as its typed-stage code
|
|
47
42
|
# ("stage" => "pren"); #inflate_scalar_components rebuilds
|
|
48
43
|
# the three components from it (the coded compact-hash shape).
|
|
44
|
+
# A PUBLISHED trio stays nested: the coded flavors that
|
|
45
|
+
# carry one (the designations) serialize type/stage/
|
|
46
|
+
# typed_stage in full — only a draft stage compacts.
|
|
49
47
|
def self.compact_hash(model, hash)
|
|
50
48
|
stage = model.typed_stage
|
|
51
49
|
return unless stage && hash.key?("typed_stage")
|
|
50
|
+
return if stage.stage_code.to_s == "published"
|
|
52
51
|
return unless model.type == stage.to_type &&
|
|
53
52
|
model.stage == stage.to_stage
|
|
54
53
|
|
|
@@ -17,19 +17,16 @@ 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
|
|
28
|
-
|
|
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).
|
|
26
|
+
attribute :base, ::Pubid::Identifier, polymorphic: true
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
28
|
+
# The column IS the uniform parent accessor: #root and
|
|
29
|
+
# #base_document are the shared machinery's, walking it.
|
|
33
30
|
|
|
34
31
|
# MR "cen.iso.ts.21003-7": the publisher group fused, then the
|
|
35
32
|
# adopted document's own MR string in place of a number.
|
|
@@ -38,10 +35,23 @@ module Pubid
|
|
|
38
35
|
.map { |p| p.to_s.downcase })
|
|
39
36
|
end
|
|
40
37
|
|
|
38
|
+
# The wrapper carries no identity of its own: the MR slug
|
|
39
|
+
# reads the ROOT document (the coded RootIdentity shape),
|
|
40
|
+
# so an adoption slugs bs.1073-2.2002, not the adopted
|
|
41
|
+
# document's own MR string.
|
|
41
42
|
def mr_number_with_part
|
|
42
|
-
|
|
43
|
+
root.equal?(self) ? super : root.mr_number_with_part
|
|
43
44
|
end
|
|
44
45
|
|
|
46
|
+
def mr_year
|
|
47
|
+
root.equal?(self) ? super : root.mr_year
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# The wrapper's own edition face (the declared glued ED
|
|
51
|
+
# form): the hook lifts the trailing face+ordinal out of
|
|
52
|
+
# the adopted run onto this column.
|
|
53
|
+
attribute :edition, :string
|
|
54
|
+
|
|
45
55
|
# The scheme-canonical wire tag declared in the definition:
|
|
46
56
|
# to_hash stays byte-identical with the scheme's coded
|
|
47
57
|
# flavor, and this flavor's own from_hash routes the tag
|
|
@@ -17,19 +17,16 @@ 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
|
|
28
|
-
|
|
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).
|
|
26
|
+
attribute :base, ::Pubid::Identifier, polymorphic: true
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
28
|
+
# The column IS the uniform parent accessor: #root and
|
|
29
|
+
# #base_document are the shared machinery's, walking it.
|
|
33
30
|
|
|
34
31
|
# MR "cen.iso.ts.21003-7": the publisher group fused, then the
|
|
35
32
|
# adopted document's own MR string in place of a number.
|
|
@@ -38,10 +35,23 @@ module Pubid
|
|
|
38
35
|
.map { |p| p.to_s.downcase })
|
|
39
36
|
end
|
|
40
37
|
|
|
38
|
+
# The wrapper carries no identity of its own: the MR slug
|
|
39
|
+
# reads the ROOT document (the coded RootIdentity shape),
|
|
40
|
+
# so an adoption slugs bs.1073-2.2002, not the adopted
|
|
41
|
+
# document's own MR string.
|
|
41
42
|
def mr_number_with_part
|
|
42
|
-
|
|
43
|
+
root.equal?(self) ? super : root.mr_number_with_part
|
|
43
44
|
end
|
|
44
45
|
|
|
46
|
+
def mr_year
|
|
47
|
+
root.equal?(self) ? super : root.mr_year
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# The wrapper's own edition face (the declared glued ED
|
|
51
|
+
# form): the hook lifts the trailing face+ordinal out of
|
|
52
|
+
# the adopted run onto this column.
|
|
53
|
+
attribute :edition, :string
|
|
54
|
+
|
|
45
55
|
# The scheme-canonical wire tag declared in the definition:
|
|
46
56
|
# to_hash stays byte-identical with the scheme's coded
|
|
47
57
|
# flavor, and this flavor's own from_hash routes the tag
|
|
@@ -2,7 +2,8 @@ module Pubid
|
|
|
2
2
|
module BsiPfs
|
|
3
3
|
module Identifiers
|
|
4
4
|
# The consolidated (plus-run) bundle: the base document is
|
|
5
|
-
# the first member;
|
|
5
|
+
# the first member; each member amends it, so the members
|
|
6
|
+
# carry it as their base (the coded builder's shape).
|
|
6
7
|
class ConsolidatedIdentifier < ::Pubid::BsiPfs::Identifier
|
|
7
8
|
attribute :identifiers, ::Pubid::BsiPfs::Identifier,
|
|
8
9
|
polymorphic: true, collection: true
|
|
@@ -21,15 +22,30 @@ module Pubid
|
|
|
21
22
|
identifiers&.first || self
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
# The
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
# The declared marker-less bundle (the coded-BSI shape): the
|
|
26
|
+
# wrapper reads the base document's identity and drops the
|
|
27
|
+
# member suffixes — the delegated publisher (off the wrapper's
|
|
28
|
+
# own wire entry, the coded compact-hash rule), the typed trio
|
|
29
|
+
# the base document carries, and the root-through MR hooks.
|
|
30
|
+
def type
|
|
31
|
+
member = identifiers&.first
|
|
32
|
+
member.respond_to?(:typed_stage) && member.typed_stage ? member.type : nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def publisher
|
|
36
|
+
identifiers&.first&.publisher
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.compact_hash(_model, hash)
|
|
40
|
+
hash.delete("publisher")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def mr_number_with_part
|
|
44
|
+
root.equal?(self) ? super : root.mr_number_with_part
|
|
45
|
+
end
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.join(::Pubid::Renderers::MrString::SEPARATOR_SUPPLEMENT)
|
|
47
|
+
def mr_year
|
|
48
|
+
root.equal?(self) ? super : root.mr_year
|
|
33
49
|
end
|
|
34
50
|
|
|
35
51
|
def self.polymorphic_name
|
|
@@ -4,6 +4,11 @@ module Pubid
|
|
|
4
4
|
# Concrete Draft Document identifier type (PFS type `draft_document`).
|
|
5
5
|
class DraftDocument < Identifier
|
|
6
6
|
TYPED_STAGES = [
|
|
7
|
+
::Pubid::Components::TypedStage.new(
|
|
8
|
+
code: :pubdd, stage_code: :published,
|
|
9
|
+
type_code: :dd, abbr: ["DD"],
|
|
10
|
+
name: "Draft Document", harmonized_stages: ["60.00", "60.60"],
|
|
11
|
+
),
|
|
7
12
|
].freeze
|
|
8
13
|
|
|
9
14
|
def self.type
|
|
@@ -13,15 +18,10 @@ module Pubid
|
|
|
13
18
|
# The publisher default (feature 5): the type's own token
|
|
14
19
|
# when the type is its designation, else the scheme default.
|
|
15
20
|
def self.default_publisher
|
|
16
|
-
::Pubid::Components::Publisher.new(body: "
|
|
21
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
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
25
|
|
|
26
26
|
# The scheme-canonical wire tag declared in the definition:
|
|
27
27
|
# to_hash stays byte-identical with the scheme's coded
|
|
@@ -4,6 +4,11 @@ module Pubid
|
|
|
4
4
|
# Concrete Publicly Available Specification identifier type (PFS type `publicly_available_specification`).
|
|
5
5
|
class PubliclyAvailableSpecification < Identifier
|
|
6
6
|
TYPED_STAGES = [
|
|
7
|
+
::Pubid::Components::TypedStage.new(
|
|
8
|
+
code: :pubpas, stage_code: :published,
|
|
9
|
+
type_code: :pas, abbr: ["PAS"],
|
|
10
|
+
name: "Publicly Available Specification", harmonized_stages: ["60.00", "60.60"],
|
|
11
|
+
),
|
|
7
12
|
].freeze
|
|
8
13
|
|
|
9
14
|
def self.type
|
|
@@ -13,15 +18,10 @@ module Pubid
|
|
|
13
18
|
# The publisher default (feature 5): the type's own token
|
|
14
19
|
# when the type is its designation, else the scheme default.
|
|
15
20
|
def self.default_publisher
|
|
16
|
-
::Pubid::Components::Publisher.new(body: "
|
|
21
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
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
25
|
|
|
26
26
|
# The scheme-canonical wire tag declared in the definition:
|
|
27
27
|
# to_hash stays byte-identical with the scheme's coded
|
|
@@ -4,6 +4,11 @@ module Pubid
|
|
|
4
4
|
# Concrete Published Document identifier type (PFS type `published_document`).
|
|
5
5
|
class PublishedDocument < Identifier
|
|
6
6
|
TYPED_STAGES = [
|
|
7
|
+
::Pubid::Components::TypedStage.new(
|
|
8
|
+
code: :pubpd, stage_code: :published,
|
|
9
|
+
type_code: :pd, abbr: ["PD"],
|
|
10
|
+
name: "Published Document", harmonized_stages: ["60.00", "60.60"],
|
|
11
|
+
),
|
|
7
12
|
].freeze
|
|
8
13
|
|
|
9
14
|
def self.type
|
|
@@ -13,15 +18,10 @@ module Pubid
|
|
|
13
18
|
# The publisher default (feature 5): the type's own token
|
|
14
19
|
# when the type is its designation, else the scheme default.
|
|
15
20
|
def self.default_publisher
|
|
16
|
-
::Pubid::Components::Publisher.new(body: "
|
|
21
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
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
25
|
|
|
26
26
|
# The scheme-canonical wire tag declared in the definition:
|
|
27
27
|
# to_hash stays byte-identical with the scheme's coded
|
|
@@ -4,6 +4,11 @@ module Pubid
|
|
|
4
4
|
# Concrete Technical Specification identifier type (PFS type `technical_specification`).
|
|
5
5
|
class TechnicalSpecification < Identifier
|
|
6
6
|
TYPED_STAGES = [
|
|
7
|
+
::Pubid::Components::TypedStage.new(
|
|
8
|
+
code: :pubts, stage_code: :published,
|
|
9
|
+
type_code: :ts, abbr: ["TS"],
|
|
10
|
+
name: "Technical Specification", harmonized_stages: ["60.00", "60.60"],
|
|
11
|
+
),
|
|
7
12
|
].freeze
|
|
8
13
|
|
|
9
14
|
def self.type
|
|
@@ -13,15 +18,10 @@ module Pubid
|
|
|
13
18
|
# The publisher default (feature 5): the type's own token
|
|
14
19
|
# when the type is its designation, else the scheme default.
|
|
15
20
|
def self.default_publisher
|
|
16
|
-
::Pubid::Components::Publisher.new(body: "
|
|
21
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
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
25
|
|
|
26
26
|
# The scheme-canonical wire tag declared in the definition:
|
|
27
27
|
# to_hash stays byte-identical with the scheme's coded
|
|
@@ -6,17 +6,30 @@
|
|
|
6
6
|
# namespace; identifiers carry the scheme's wire tag, so their
|
|
7
7
|
# pubid URNs encode through the scheme's own schema.
|
|
8
8
|
PubidUrnSchema = Pubid::PubidUrn.define("bsi_pfs") do
|
|
9
|
-
atom "publisher", "
|
|
9
|
+
atom "publisher.body", "pubbody"
|
|
10
10
|
atom "part", "part"
|
|
11
11
|
atom "year", "year"
|
|
12
|
-
atom "
|
|
12
|
+
atom "edition", "ed"
|
|
13
|
+
atom "type.abbr", "typeabbr"
|
|
14
|
+
atom "type.name", "typename"
|
|
15
|
+
atom "type.type_code", "typetypecode"
|
|
16
|
+
atom "stage.abbr", "stageabbr"
|
|
17
|
+
atom "stage.name", "stagename"
|
|
18
|
+
atom "stage.stage_code", "stagecode"
|
|
19
|
+
atom "stage.harmonized_stages", "stagehs", kind: :list
|
|
20
|
+
atom "typed_stage.abbr", "tsabbr", kind: :list
|
|
21
|
+
atom "typed_stage.name", "tsname"
|
|
22
|
+
atom "typed_stage.code", "tscode"
|
|
23
|
+
atom "typed_stage.stage_code", "tsstagecode"
|
|
24
|
+
atom "typed_stage.type_code", "tstypecode"
|
|
25
|
+
atom "typed_stage.harmonized_stages", "tshs", kind: :list
|
|
13
26
|
atom "identifiers", "ids", kind: :ids
|
|
14
27
|
type "pubid:bsi:adopted-european-norm", "aen", core: []
|
|
15
28
|
type "pubid:bsi:adopted-international-standard", "ais", core: []
|
|
16
|
-
type "pubid:bsi:amendment", "amd", core: []
|
|
29
|
+
type "pubid:bsi:amendment", "amd", core: ["number"]
|
|
17
30
|
type "pubid:bsi:british-standard", "bs", core: ["number"]
|
|
18
31
|
type "pubid:bsi:consolidated-identifier", "consol", core: []
|
|
19
|
-
type "pubid:bsi:corrigendum", "cor", core: []
|
|
32
|
+
type "pubid:bsi:corrigendum", "cor", core: ["number"]
|
|
20
33
|
type "pubid:bsi:draft-document", "dd", core: ["number"]
|
|
21
34
|
type "pubid:bsi:published-document", "pd", core: ["number"]
|
|
22
35
|
type "pubid:bsi:publicly-available-specification", "pas", core: ["number"]
|
|
@@ -2,6 +2,11 @@ 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): the token that
|
|
6
|
+
# selected the class prints where the face names the
|
|
7
|
+
# publisher — the column keeps the organization default.
|
|
8
|
+
DESIGNATION_FACES = ["PAS", "PD", "DD", "TS"].freeze
|
|
9
|
+
|
|
5
10
|
def render(**_opts)
|
|
6
11
|
f = render_fields(@id)
|
|
7
12
|
"#{if f[:publisher] && f[:adopted]; "#{f[:publisher]} #{f[:adopted]}" elsif f[:publisher] && f[:number]; "#{f[:publisher]} #{f[:number]}#{("-#{f[:part]}") if f[:part]}#{(":#{f[:year]}") if f[:year]}"; end}#{("#{f[:supplements]}") if f[:supplements]}"
|
|
@@ -9,6 +14,17 @@ module Pubid
|
|
|
9
14
|
|
|
10
15
|
private
|
|
11
16
|
|
|
17
|
+
# The adoption face: the adopted document, with the
|
|
18
|
+
# wrapper's own edition face after it (the declared glued
|
|
19
|
+
# ED form — the hook lifts the ordinal onto the wrapper).
|
|
20
|
+
def view_adopted(root)
|
|
21
|
+
adopted = root.respond_to?(:base) ? root.base : nil
|
|
22
|
+
return nil unless adopted
|
|
23
|
+
|
|
24
|
+
edition = root.edition
|
|
25
|
+
edition ? "#{adopted} ED#{edition}" : adopted.to_s
|
|
26
|
+
end
|
|
27
|
+
|
|
12
28
|
# The field view: a wrapper reads through to the wrapped
|
|
13
29
|
# standard and composes the printed run once — the standalone
|
|
14
30
|
# chain behind its slash, the consolidated members behind the
|
|
@@ -31,11 +47,11 @@ module Pubid
|
|
|
31
47
|
run << "+#{member.supplement_notation}"
|
|
32
48
|
end
|
|
33
49
|
view = {
|
|
34
|
-
publisher: root.publisher&.respond_to?(:body) ? root.publisher.body : root.publisher,
|
|
50
|
+
publisher: (t = root.type&.abbr) && DESIGNATION_FACES.include?(t) ? t : (root.publisher&.respond_to?(:body) ? root.publisher.body : root.publisher),
|
|
35
51
|
number: root.number,
|
|
36
52
|
part: root.part,
|
|
37
53
|
year: root.date&.year,
|
|
38
|
-
adopted: root
|
|
54
|
+
adopted: view_adopted(root),
|
|
39
55
|
}
|
|
40
56
|
view[:supplements] = run.empty? ? nil : run
|
|
41
57
|
view
|
|
@@ -5,8 +5,8 @@ module Pubid
|
|
|
5
5
|
# (feature 6) — the publisher group, the adopted document's
|
|
6
6
|
# fused MR string, the composed code, the year, the draft
|
|
7
7
|
# stage. A wrapper reads through to its subject and appends
|
|
8
|
-
# its declared chain; the
|
|
9
|
-
# member
|
|
8
|
+
# its declared chain; the marker-less bundle appends each
|
|
9
|
+
# member's chain directly (the coded-BSI shape).
|
|
10
10
|
class UrnGenerator < ::Pubid::UrnGenerator::Base
|
|
11
11
|
def urn_namespace
|
|
12
12
|
"bsi"
|
|
@@ -31,7 +31,6 @@ module Pubid
|
|
|
31
31
|
parts.concat(official_segments)
|
|
32
32
|
parts.concat(wrapper)
|
|
33
33
|
members&.each do |member|
|
|
34
|
-
parts << "plus"
|
|
35
34
|
parts.concat(wrapper_segments(member))
|
|
36
35
|
end
|
|
37
36
|
parts.concat(frag_segments)
|
|
@@ -43,13 +42,39 @@ module Pubid
|
|
|
43
42
|
def official_segments
|
|
44
43
|
segments = []
|
|
45
44
|
segments << @identifier.publisher.to_s.downcase if @identifier.publisher
|
|
46
|
-
segments <<
|
|
47
|
-
segments << "-" +
|
|
48
|
-
|
|
45
|
+
segments << identity(:number) if identity(:number)
|
|
46
|
+
segments << "-" + identity(:part).to_s if identity(:part)
|
|
47
|
+
segments << "-" + identity(:subpart).to_s if identity(:subpart)
|
|
48
|
+
date = [identity(:date)&.year].compact
|
|
49
49
|
segments << date.join("-") unless date.empty?
|
|
50
|
+
segments << "v" + @identifier.edition.to_s if @identifier.edition
|
|
51
|
+
if @identifier.type
|
|
52
|
+
type = @identifier.type&.abbr || @identifier.type.to_s
|
|
53
|
+
segments << type.to_s.downcase if type && type.to_s != "BS"
|
|
54
|
+
end
|
|
55
|
+
# The typed trio's own stage segment (the declared published
|
|
56
|
+
# form): it fires for published rows too — the coded
|
|
57
|
+
# generator's own comparison (a stage_code String is never
|
|
58
|
+
# the :published Symbol).
|
|
59
|
+
code = @identifier.typed_stage&.stage_code
|
|
60
|
+
segments << "stage." + code.to_s if code && code != :published
|
|
50
61
|
segments
|
|
51
62
|
end
|
|
52
63
|
|
|
64
|
+
# An identity attribute of the identifier, or of the document
|
|
65
|
+
# it wraps (the declared root-through): the adoption wrapper
|
|
66
|
+
# carries no identity of its own, so its official segments
|
|
67
|
+
# read the ROOT document's. #root is +self+ for a non-wrapper,
|
|
68
|
+
# so an ordinary identifier reads its own value and nothing
|
|
69
|
+
# changes.
|
|
70
|
+
def identity(attr)
|
|
71
|
+
own = @identifier.public_send(attr)
|
|
72
|
+
return own if own
|
|
73
|
+
|
|
74
|
+
root = @identifier.root
|
|
75
|
+
root.equal?(@identifier) ? nil : root.public_send(attr)
|
|
76
|
+
end
|
|
77
|
+
|
|
53
78
|
# One wrapper's declared URN chain: the kind word, then the
|
|
54
79
|
# wrapper's columns (the ordinal, the year-month date).
|
|
55
80
|
def wrapper_segments(id)
|
data/lib/pubid/version.rb
CHANGED