pubid 2.0.41 → 2.0.42

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.
data/data/parg/iso.parg CHANGED
@@ -190,13 +190,17 @@ grammar PubidIso version "0.5.0" edition 2 {
190
190
  jcgm_identifier = "JCGM" as publisher space second_part third_part
191
191
 
192
192
  # ---- NSB stage prefixes: "FprISO 105-A03", "WD/ISO 10360-5:2000" ----
193
+ ## #118: the stage-to-publisher join differs per branch — the Fpr form
194
+ ## glues onto the publisher, the WD form carries a slash. The slash
195
+ ## captures as nsb_stage_slash so the render emits the join per shape
196
+ ## (the Fpr branch binds nothing to join with).
193
197
  nsb_iso_identifier = {
194
198
  (
195
199
  ("Fpr" as nsb_stage) prefix_sole_publisher [space] [copublishers] [space] [type_with_stage] [space] second_part third_part
196
200
  )
197
201
  /
198
202
  (
199
- ("WD" as nsb_stage) slash prefix_sole_publisher [space] [copublishers] [space] [type_with_stage] [space] second_part third_part
203
+ ("WD" as nsb_stage) (slash as nsb_stage_slash) prefix_sole_publisher [space] [copublishers] [space] [type_with_stage] [space] second_part third_part
200
204
  )
201
205
  }
202
206
 
@@ -213,7 +217,11 @@ grammar PubidIso version "0.5.0" edition 2 {
213
217
  slash sc_type space (1*digit) as sc_number
214
218
  )
215
219
  }
216
- tc_document = prefix_sole_publisher (slash / space) tc_type space (1*digit) as tc_number [tc_subcommittee_part] space "N" [space] (1*digit) as number [(colon (("19" / "20") 2*digit !digit) as year)]
220
+ ## #118: the publisher-to-type join is "/" or a space per the input's
221
+ ## own spelling; it captures as tc_join so the render emits the
222
+ ## captured join back (a canonical slash would re-bind a space-joined
223
+ ## input to the other alternative's value).
224
+ tc_document = prefix_sole_publisher ((slash / space) as tc_join) tc_type space (1*digit) as tc_number [tc_subcommittee_part] space "N" [space] (1*digit) as number [(colon (("19" / "20") 2*digit !digit) as year)]
217
225
  bare_tc_document = {
218
226
  (1*digit) as tc_number
219
227
  slash sc_type space (1*digit) as sc_number
@@ -723,6 +731,7 @@ grammar PubidIso version "0.5.0" edition 2 {
723
731
  type_with_stage_fr -> type_with_stage_fr (string)
724
732
  base_edition -> base_edition (string)
725
733
  nsb_stage -> nsb_stage (string)
734
+ nsb_stage_slash -> nsb_stage_slash (string)
726
735
  iso_r_prefix -> iso_r_prefix (string)
727
736
  number_with_part -> number_with_part (string)
728
737
  stage_iteration -> stage_iteration (string)
@@ -733,6 +742,7 @@ grammar PubidIso version "0.5.0" edition 2 {
733
742
  all_parts -> all_parts (string)
734
743
  year -> year (string)
735
744
  tc_type -> tc_type (string)
745
+ tc_join -> tc_join (string)
736
746
  tc_number -> tc_number (string)
737
747
  sc_type -> sc_type (string)
738
748
  sc_number -> sc_number (string)
@@ -871,6 +881,49 @@ bs3_undated_marker -> bs3_undated_marker (string)
871
881
  ballot_stamp_number: "1"
872
882
  ballot_stamp_date: "2006"
873
883
  }
884
+ # #118: the nsb_stage face — the Fpr branch glues onto the publisher,
885
+ # the WD branch carries the captured slash (nsb_stage_slash).
886
+ accept "FprISO 10140-4"
887
+ accept "FprISO 13679"
888
+ accept "FprISO/IEC 17029"
889
+ accept "WD/ISO 10360-2"
890
+ example "FprISO 105-A03" {
891
+ nsb_stage: "Fpr"
892
+ publisher: "ISO"
893
+ number_with_part: "105-A03"
894
+ }
895
+ example "WD/ISO 10360-5:2000" {
896
+ nsb_stage: "WD"
897
+ nsb_stage_slash: "/"
898
+ date: "2000"
899
+ }
900
+ # #118: the publisher-bearing tc_document face — the join captures as
901
+ # tc_join, the type as tc_type (the bare-TC face binds neither).
902
+ accept "ISO/TC 184/SC 4 N 789"
903
+ accept "ISO/TC 184/SC/QC 4 N246"
904
+ accept "ISO/TC 184 N 100"
905
+ accept "ISO/TC 184 N 100:2024"
906
+ accept "ISO TC 46 N 3064"
907
+ example "ISO/TC 184/SC 4/WG 3 N 123" {
908
+ tc_join: "/"
909
+ tc_type: "TC"
910
+ tc_number: "184"
911
+ sc_number: "4"
912
+ wg_number: "3"
913
+ number: "123"
914
+ }
915
+ example "ISO TC 46 N 3064" {
916
+ tc_join: " "
917
+ tc_type: "TC"
918
+ tc_number: "46"
919
+ number: "3064"
920
+ }
921
+ example "ISO/JTC 1 N 456" {
922
+ tc_join: "/"
923
+ tc_type: "JTC"
924
+ tc_number: "1"
925
+ number: "456"
926
+ }
874
927
  }
875
928
  }
876
929
 
@@ -880,12 +933,360 @@ preprocess publisher_names {
880
933
 
881
934
  derive urn "urn:iso:std:{number_with_part}:{date}"
882
935
 
936
+ # F6 render spec, #116: every bound field, in a join order that re-parses
937
+ # to the same bound map (the rs#459 round-trip oracle). The rules the
938
+ # segments obey, checked line-by-line against the identifier rules above:
939
+ #
940
+ # - The publisher joins the number with a SPACE (`prefix_sole_publisher =
941
+ # publisher [space] ...`); the dash the old spec emitted is never
942
+ # grammar-valid there. Shapes with no publisher at all (bare TC
943
+ # documents, the ISO/R forms) render no prefix and no separator.
944
+ # - `copublishers` captures WITH its leading slash, so `publisher`
945
+ # + `copublishers` needs no separator between them.
946
+ # - A typed stage after the prefix is joined with a space: the copublisher
947
+ # spine accepts `[space] [slash] [type_with_stage]`, and the space form
948
+ # re-parses to the same map for every stage-bearing shape ("ISO/WD Study
949
+ # 42010" renders as "ISO WD Study 42010" — the bound map is identical).
950
+ # - A ballot stage always renders slash-prefixed: the TYPE-first ballot
951
+ # branch takes `[space] [slash] ballot_type_with_stage` after the
952
+ # prefix, so "ISO/IEC PDAM 2 10646:2012" renders as
953
+ # "ISO/IEC/PDAM 2 10646:2012" and re-parses through the same branch to
954
+ # the same map; the space-attached ballot face re-parses through the
955
+ # same branch too.
956
+ # - The ballot stamp's abbrev token is decode-away (matched uncaptured),
957
+ # so the stamp renders the canonical "/Amd" spelling: the re-parse binds
958
+ # stamp number/date only, and the abbrev spelling is not identity. The
959
+ # dot-number stamp alternative is a different bound field
960
+ # (ballot_stamp_dot_number), so the number renders in the spaced form.
961
+ # - Supplements join with "/" + the bound abbrev; the ISO/R supplement
962
+ # layer takes the slash separator alternative of
963
+ # iso_r_supplement_separator.
964
+ # - The joint renders " | " (the `[space] "|" [space]` join, house form).
965
+ # - The undated marker renders after its colon (`date = (colon / dash)
966
+ # [date_core]`), and bare-TC documents keep the glued `N<number>` the
967
+ # bare_tc_document rule accepts.
968
+ # - The NSB stage renders BEFORE the publisher, with the join its own
969
+ # branch bound (#118): the Fpr branch binds no join face, so "FprISO
970
+ # 105-A03" renders glued ("FprISO 105-A03"); the WD branch captures the
971
+ # slash as nsb_stage_slash, so "WD/ISO 10360-5:2000" renders
972
+ # "WD/ISO 10360-5:2000". (The coded flavor decodes the NSB stage onto
973
+ # the modern stage face — "ISO/PRF 105-A03" — which would re-bind a
974
+ # different map; the render keeps the bound faces instead.)
975
+ # - The publisher-bearing tc_document face renders the join AS CAPTURED
976
+ # (#118): a canonical slash would re-bind a space-joined input to the
977
+ # other alternative, so `field tc_join` emits "/" or " " per the input.
978
+ # The type follows space-joined (the rule's own `tc_type space`), then
979
+ # the shared bare-TC cluster — "ISO/TC 184/SC 4/WG 3 N 123" renders as
980
+ # "ISO/TC 184/SC 4/WG 3 N123", the glued N the cluster already uses
981
+ # (spelling, not identity; the re-parse binds the identical map).
883
982
  render default {
884
- field publisher
885
- literal "-"
886
- field number_with_part
983
+ cond nsb_stage {
984
+ field nsb_stage
985
+ cond nsb_stage_slash {
986
+ field nsb_stage_slash
987
+ }
988
+ }
989
+ cond type_with_stage_fr {
990
+ field type_with_stage_fr
991
+ literal " "
992
+ }
993
+ cond iso_r_prefix {
994
+ field iso_r_prefix
995
+ }
996
+ cond publisher {
997
+ field publisher
998
+ }
999
+ # #118: the tc_document face — the join renders as captured, the type
1000
+ # space-joined per the rule's own `tc_type space`. Neither face is
1001
+ # bound by any other spine, so the segments are inert everywhere else.
1002
+ cond tc_join {
1003
+ field tc_join
1004
+ }
1005
+ cond tc_type {
1006
+ field tc_type
1007
+ literal " "
1008
+ }
1009
+ cond copublishers {
1010
+ field copublishers
1011
+ }
1012
+ cond subgroup {
1013
+ literal " "
1014
+ field subgroup
1015
+ }
1016
+ cond tc_number {
1017
+ field tc_number
1018
+ # #118: the subcommittee tail is OPTIONAL on the publisher-bearing
1019
+ # tc_document face (the bare face always carries it), so the slash
1020
+ # rides on the SC's presence — "ISO/TC 184 N 100" renders without a
1021
+ # dangling "/".
1022
+ cond sc_type {
1023
+ literal "/"
1024
+ field sc_type
1025
+ literal " "
1026
+ field sc_number
1027
+ cond wg_type {
1028
+ literal "/"
1029
+ field wg_type
1030
+ literal " "
1031
+ field wg_number
1032
+ }
1033
+ }
1034
+ literal " N"
1035
+ field number
1036
+ cond year {
1037
+ literal ":"
1038
+ field year
1039
+ }
1040
+ }
1041
+ cond ballot_type_with_stage {
1042
+ literal "/"
1043
+ field ballot_type_with_stage
1044
+ cond ballot_number {
1045
+ literal " "
1046
+ field ballot_number
1047
+ }
1048
+ }
1049
+ cond type_with_stage {
1050
+ literal " "
1051
+ field type_with_stage
1052
+ }
1053
+ cond number_with_part {
1054
+ literal " "
1055
+ field number_with_part
1056
+ }
1057
+ cond stage_iteration {
1058
+ literal "."
1059
+ field stage_iteration
1060
+ }
887
1061
  cond date {
888
1062
  literal ":"
889
1063
  field date
890
1064
  }
1065
+ cond undated_marker {
1066
+ literal ":"
1067
+ field undated_marker
1068
+ }
1069
+ cond base_edition {
1070
+ literal " "
1071
+ field base_edition
1072
+ }
1073
+ cond ballot_stamp_number {
1074
+ literal "/Amd "
1075
+ field ballot_stamp_number
1076
+ cond ballot_stamp_date {
1077
+ literal ":"
1078
+ field ballot_stamp_date
1079
+ }
1080
+ cond ballot_stamp_undated_marker {
1081
+ literal ":"
1082
+ field ballot_stamp_undated_marker
1083
+ }
1084
+ }
1085
+ cond ballot_stamp_dot_number {
1086
+ literal "/Amd."
1087
+ field ballot_stamp_dot_number
1088
+ }
1089
+ cond supp_type_with_stage {
1090
+ literal "/"
1091
+ field supp_type_with_stage
1092
+ cond supp_number_with_part {
1093
+ literal " "
1094
+ field supp_number_with_part
1095
+ }
1096
+ cond supp_stage_iteration {
1097
+ literal "."
1098
+ field supp_stage_iteration
1099
+ }
1100
+ cond supp_number {
1101
+ literal "."
1102
+ field supp_number
1103
+ }
1104
+ cond supp_date {
1105
+ literal ":"
1106
+ field supp_date
1107
+ }
1108
+ cond supp_undated_marker {
1109
+ literal ":"
1110
+ field supp_undated_marker
1111
+ }
1112
+ }
1113
+ cond supp2_type_with_stage {
1114
+ literal "/"
1115
+ field supp2_type_with_stage
1116
+ cond supp2_number_with_part {
1117
+ literal " "
1118
+ field supp2_number_with_part
1119
+ }
1120
+ cond supp2_stage_iteration {
1121
+ literal "."
1122
+ field supp2_stage_iteration
1123
+ }
1124
+ cond supp2_number {
1125
+ literal "."
1126
+ field supp2_number
1127
+ }
1128
+ cond supp2_date {
1129
+ literal ":"
1130
+ field supp2_date
1131
+ }
1132
+ cond supp2_undated_marker {
1133
+ literal ":"
1134
+ field supp2_undated_marker
1135
+ }
1136
+ }
1137
+ cond supp3_type_with_stage {
1138
+ literal "/"
1139
+ field supp3_type_with_stage
1140
+ cond supp3_number_with_part {
1141
+ literal " "
1142
+ field supp3_number_with_part
1143
+ }
1144
+ cond supp3_stage_iteration {
1145
+ literal "."
1146
+ field supp3_stage_iteration
1147
+ }
1148
+ cond supp3_number {
1149
+ literal "."
1150
+ field supp3_number
1151
+ }
1152
+ cond supp3_date {
1153
+ literal ":"
1154
+ field supp3_date
1155
+ }
1156
+ cond supp3_undated_marker {
1157
+ literal ":"
1158
+ field supp3_undated_marker
1159
+ }
1160
+ }
1161
+ cond isor_supp_type_with_stage {
1162
+ literal "/"
1163
+ field isor_supp_type_with_stage
1164
+ cond isor_supp_number_with_part {
1165
+ literal " "
1166
+ field isor_supp_number_with_part
1167
+ }
1168
+ cond isor_supp_stage_iteration {
1169
+ literal "."
1170
+ field isor_supp_stage_iteration
1171
+ }
1172
+ cond isor_supp_date {
1173
+ literal ":"
1174
+ field isor_supp_date
1175
+ }
1176
+ cond isor_supp_undated_marker {
1177
+ literal ":"
1178
+ field isor_supp_undated_marker
1179
+ }
1180
+ }
1181
+ cond idf_publisher {
1182
+ literal " | "
1183
+ field idf_publisher
1184
+ cond idf_type_with_stage {
1185
+ literal "/"
1186
+ field idf_type_with_stage
1187
+ }
1188
+ cond idf_stage_iteration {
1189
+ literal "."
1190
+ field idf_stage_iteration
1191
+ }
1192
+ cond idf_number_with_part {
1193
+ literal " "
1194
+ field idf_number_with_part
1195
+ }
1196
+ cond idf_date {
1197
+ literal ":"
1198
+ field idf_date
1199
+ }
1200
+ cond idf_languages {
1201
+ literal "("
1202
+ field idf_languages
1203
+ literal ")"
1204
+ }
1205
+ cond idf_all_parts {
1206
+ literal " "
1207
+ field idf_all_parts
1208
+ }
1209
+ }
1210
+ cond edition {
1211
+ literal " "
1212
+ field edition
1213
+ }
1214
+ cond languages {
1215
+ literal "("
1216
+ field languages
1217
+ literal ")"
1218
+ }
1219
+ cond all_parts {
1220
+ literal " "
1221
+ field all_parts
1222
+ }
1223
+ cond dsupp_publisher {
1224
+ literal " "
1225
+ field dsupp_publisher
1226
+ literal " "
1227
+ field dsupp_type_with_stage
1228
+ cond dsupp_date {
1229
+ literal ":"
1230
+ field dsupp_date
1231
+ }
1232
+ cond dsupp_undated_marker {
1233
+ literal ":"
1234
+ field dsupp_undated_marker
1235
+ }
1236
+ cond dsupp_edition {
1237
+ literal " "
1238
+ field dsupp_edition
1239
+ }
1240
+ cond dsupp_languages {
1241
+ literal "("
1242
+ field dsupp_languages
1243
+ literal ")"
1244
+ }
1245
+ cond dsupp_all_parts {
1246
+ literal " "
1247
+ field dsupp_all_parts
1248
+ }
1249
+ }
1250
+ cond bs1_publisher {
1251
+ literal " + "
1252
+ field bs1_publisher
1253
+ literal " "
1254
+ field bs1_type_with_stage
1255
+ cond bs1_date {
1256
+ literal ":"
1257
+ field bs1_date
1258
+ }
1259
+ cond bs1_undated_marker {
1260
+ literal ":"
1261
+ field bs1_undated_marker
1262
+ }
1263
+ }
1264
+ cond bs2_publisher {
1265
+ literal " + "
1266
+ field bs2_publisher
1267
+ literal " "
1268
+ field bs2_type_with_stage
1269
+ cond bs2_date {
1270
+ literal ":"
1271
+ field bs2_date
1272
+ }
1273
+ cond bs2_undated_marker {
1274
+ literal ":"
1275
+ field bs2_undated_marker
1276
+ }
1277
+ }
1278
+ cond bs3_publisher {
1279
+ literal " + "
1280
+ field bs3_publisher
1281
+ literal " "
1282
+ field bs3_type_with_stage
1283
+ cond bs3_date {
1284
+ literal ":"
1285
+ field bs3_date
1286
+ }
1287
+ cond bs3_undated_marker {
1288
+ literal ":"
1289
+ field bs3_undated_marker
1290
+ }
1291
+ }
891
1292
  }
@@ -228,3 +228,28 @@
228
228
  non-`Withdrawn` references, 2026-11-14) this was the only failure; the
229
229
  `Withdrawn …` rows fail too, but the crawler skips them. Locked by
230
230
  `spec/pubid/iso/update_codes_spec.rb`.
231
+
232
+ - **The artifact runs the #118 grammar at parsanol 1.5.1.0 (the fleet
233
+ re-seal's last hold-out, pubid#749).** Grammar#118 (1f84627) added two
234
+ spelling-preserving captures — `nsb_stage_slash` (the WD face's
235
+ stage-to-publisher join: "WD" carries a slash, "Fpr" glues) and
236
+ `tc_join` (the tc_document face's publisher-to-type join, "/" or " ")
237
+ — so the grammar's own render emits the input's join back byte-exactly.
238
+ This builder **decodes** both faces to the canonical form instead, so
239
+ the capture spellings are consumed and dropped: the nsb decode deletes
240
+ `:nsb_stage_slash` beside `:nsb_stage`, and `cast` returns nil for
241
+ `:tc_join`. Without that consumption the ISO `cast`'s unknown-key raise
242
+ (`Unknown parameter type:`) rejects every WD/ISO and tc face — the new
243
+ artifact alone is NOT loadable by the old builder. Net behavior is
244
+ byte-identical to the 1.3.126 bake: all 7,852 stored corpus faces
245
+ replay identically on `to_s`/`to_hash`/URNs (only the raw bound map of
246
+ the two WD faces gains `nsb_stage_slash: "/"`; zero accept deltas).
247
+ The canonical renders: "WD/ISO 10360-2" → "ISO/WD 10360-2",
248
+ "FprISO 105-A03" → "ISO/PRF 105-A03", "ISO TC 46 N 3064" (space join)
249
+ → "ISO/TC 46 N 3064". Locked by `spec/pubid/iso/nsb_tc_captures_spec.rb`
250
+ (artifact stamp: compiler_version 1.5.1.0 + the #118 source_hash; the
251
+ bound captures; the canonical decodes; from_hash round-trips on all 13
252
+ attested faces). The tc cluster now rides the fixture corpus
253
+ (`identifiers/full/iso-pubid-tc-documents.txt` →
254
+ `pass/tc_document.txt`, 7 faces) and the testsuite exports them as
255
+ `tests/iso/tc_document.yaml` rows.
@@ -222,6 +222,13 @@ module Pubid
222
222
  # For NSB-prefixed identifiers (FprISO, WD/ISO), set stage
223
223
  if parsed_hash[:nsb_stage]
224
224
  nsb_stage = parsed_hash.delete(:nsb_stage)
225
+ # The WD face's stage-to-publisher join captures as
226
+ # nsb_stage_slash (pubid-grammar#118) so the grammar's render
227
+ # can emit the slash face back byte-exactly. This builder
228
+ # decodes to the modern stage face ("WD/ISO 10360-2" renders
229
+ # "ISO/WD 10360-2"), which keeps no spelling, so the join is
230
+ # consumed here and dropped.
231
+ parsed_hash.delete(:nsb_stage_slash)
225
232
  # Map NSB stage to typed stage
226
233
  case nsb_stage
227
234
  when "Fpr"
@@ -580,6 +587,22 @@ module Pubid
580
587
  # the Publisher component, so the field assigns nothing.
581
588
  nil
582
589
 
590
+ when :tc_join
591
+ # pubid-grammar#118: the tc_document face's publisher-to-type
592
+ # join ("/" or " ") captures as tc_join so the grammar's render
593
+ # emits the input's own join back (a canonical slash would
594
+ # re-bind a space-joined input to the other alternative). This
595
+ # flavor renders the canonical slash join ("ISO TC 46 N 3064"
596
+ # renders "ISO/TC 46 N 3064"), so the spelling assigns nothing.
597
+ nil
598
+
599
+ when :nsb_stage_slash
600
+ # pubid-grammar#118: reached on paths that skip the nsb_stage
601
+ # decode above (none today — the capture binds only beside
602
+ # nsb_stage), kept total so an unknown bound key stays a
603
+ # consumed no-op instead of a parse failure.
604
+ nil
605
+
583
606
  when :supplements
584
607
  # Handle bundled supplements (+ operator)
585
608
  # Each supplement is a hash that needs to be built
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.41"
4
+ VERSION = "2.0.42"
5
5
  end
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.41
4
+ version: 2.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.