pubid 2.0.21 → 2.0.23

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +73 -31
  3. data/data/iec/legacy-notation.md +298 -0
  4. data/data/iso/historic-schemes.md +368 -0
  5. data/data/parg/doi_pfs.json +1 -0
  6. data/data/parg/iec.json +1 -1
  7. data/data/parg/iso.json +1 -1
  8. data/data/parg/iso.parg +142 -2
  9. data/data/parg/nist.json +1 -1
  10. data/data/parg/tables/iec_typed_stages.yaml +3 -0
  11. data/data/parg/tables/typed_stages_ballots.yaml +6 -0
  12. data/data/parg/tables/typed_stages_supplements.yaml +1 -0
  13. data/lib/pubid/doi_pfs/CLAUDE.md +72 -0
  14. data/lib/pubid/doi_pfs/builder.rb +18 -0
  15. data/lib/pubid/doi_pfs/identifier.rb +36 -0
  16. data/lib/pubid/doi_pfs/identifiers/resource.rb +31 -0
  17. data/lib/pubid/doi_pfs/identifiers.rb +7 -0
  18. data/lib/pubid/doi_pfs/parser.rb +10 -0
  19. data/lib/pubid/doi_pfs/pubid_urn_schema.rb +15 -0
  20. data/lib/pubid/doi_pfs/renderer.rb +10 -0
  21. data/lib/pubid/doi_pfs/urn_generator.rb +12 -0
  22. data/lib/pubid/doi_pfs.rb +68 -0
  23. data/lib/pubid/iec/CLAUDE.md +5 -1
  24. data/lib/pubid/iec/builder.rb +47 -0
  25. data/lib/pubid/iec/identifiers/amendment.rb +34 -0
  26. data/lib/pubid/iec/identifiers/corrigendum.rb +6 -1
  27. data/lib/pubid/iec/supplement_identifier.rb +55 -25
  28. data/lib/pubid/iho/CLAUDE.md +2 -1
  29. data/lib/pubid/iho/pubid_urn_schema.rb +2 -1
  30. data/lib/pubid/iso/CLAUDE.md +49 -0
  31. data/lib/pubid/iso/builder.rb +77 -0
  32. data/lib/pubid/iso/identifiers/amendment.rb +1 -1
  33. data/lib/pubid/iso/single_identifier.rb +7 -1
  34. data/lib/pubid/nist/CLAUDE.md +84 -10
  35. data/lib/pubid/nist/builder.rb +15 -0
  36. data/lib/pubid/nist/identifiers/base.rb +52 -1
  37. data/lib/pubid/nist/identifiers/federal_information_processing_standards.rb +44 -5
  38. data/lib/pubid/nist/identifiers/special_publication.rb +15 -0
  39. data/lib/pubid/nist/preprocessor.rb +14 -12
  40. data/lib/pubid/nist/router.rb +11 -0
  41. data/lib/pubid/nist/urn_parser.rb +1 -1
  42. data/lib/pubid/version.rb +1 -1
  43. data/lib/pubid.rb +4 -0
  44. metadata +16 -2
data/data/parg/iso.parg CHANGED
@@ -11,6 +11,20 @@
11
11
  # below, whose captures carry the idf_ prefix so they never collide
12
12
  # with the ISO ones and can bind as scalars.
13
13
  #
14
+ # Historic TYPE-first ballot faces (decode-to-modern, owner ruling
15
+ # 2026-11-12): the DAM-family token in TYPE position — "ISO/IEC FDAM 1
16
+ # 14496-12:2004", "ISO/PDAM 19973-2" — and the space-attached ballot
17
+ # face "ISO 15877-5:2009 FDAM 1". Both branches sit LAST in the
18
+ # identifier alternation, so they are purely additive: every face an
19
+ # earlier branch parses keeps its exact parse. The ballot token
20
+ # captures as ballot_type_with_stage; a number on the TYPE token is
21
+ # space-bounded (ballot_number) so "PDAM 19973-2" keeps 19973 in the
22
+ # base; an on-base stamp's number/date capture as ballot_stamp_* (the
23
+ # stamp token itself matches uncaptured — the ballot's stage comes
24
+ # from the TYPE token and the decode keeps no spelling). The builder
25
+ # folds the captures into ONE amendment layer over the whole base, the
26
+ # number taken from the TYPE token, the stamp, or the implied 1.
27
+ #
14
28
  # Edition 2 with typed model bindings: every capture the builder
15
29
  # consumes is bound. Supplement layers capture into position-scoped
16
30
  # names (supp_* on the first supplement, supp2_* on the second,
@@ -23,7 +37,7 @@
23
37
 
24
38
  use idf
25
39
 
26
- grammar PubidIso version "0.4.0" edition 2 {
40
+ grammar PubidIso version "0.5.0" edition 2 {
27
41
 
28
42
  # ---- lexical (pubid/parser/common_parse_rules.rb + ISO override) ----
29
43
  digit = %x30-39
@@ -47,6 +61,7 @@ grammar PubidIso version "0.4.0" edition 2 {
47
61
  # inline the alt so the capture holds one scalar span) ----
48
62
  typed_stage_abbrev = alt from_table "typed_stages" column "abbr"
49
63
  supp_stage_abbrev = alt from_table "typed_stages_supplements" column "abbr"
64
+ ballot_stage_abbrev = alt from_table "typed_stages_ballots" column "abbr"
50
65
  directives_stage_abbrev = alt from_table "directives_typed_stages" column "abbr"
51
66
  directives_supp_stage_abbrev = alt from_table "directives_supplements_typed_stages" column "abbr"
52
67
  idf_stage_abbrev = alt from_table "idf_typed_stages" column "abbr"
@@ -395,6 +410,76 @@ grammar PubidIso version "0.4.0" edition 2 {
395
410
  )
396
411
  }
397
412
 
413
+ # ---- historic TYPE-first ballot faces (decode-to-modern) ----
414
+ ## The DAM-family ballot token in TYPE position. Captured under its
415
+ ## own name: the supplement tables' captures stay reserved for the
416
+ ## on-base layers, and the ballot's stage is the one the decode keeps.
417
+ ballot_type_with_stage = {
418
+ (
419
+ (alt from_table "typed_stages_ballots" column "abbr")
420
+ ) as ballot_type_with_stage
421
+ }
422
+ ## An on-base stamp riding a ballot face ("/Amd 9:2001", "/Amd.1",
423
+ ## "/Am1:2006"): it carries the amendment's number and ballot date
424
+ ## while its own token letters are decode-away (matched uncaptured —
425
+ ## the ballot's stage comes from the TYPE token). Mirrors the three
426
+ ## supplement tails: a (glued or spaced) number with an optional
427
+ ## date, or a dot number.
428
+ ballot_stamp = {
429
+ slash supp_stage_abbrev
430
+ (
431
+ (
432
+ [space]
433
+ ((1*5digit)) as ballot_stamp_number
434
+ [
435
+ [space]
436
+ (
437
+ (colon / dash) [
438
+ (("19" / "20") 2*digit !digit [(dash 2*digit)] [(dash 2*digit)]) as ballot_stamp_date
439
+ / (("--" / "—")) as ballot_stamp_undated_marker
440
+ ]
441
+ )
442
+ ]
443
+ )
444
+ / ( dot (1*digit) as ballot_stamp_dot_number )
445
+ )
446
+ }
447
+ ## "ISO/IEC FDAM 1 14496-12:2004", "ISO/PDAM 19973-2": the ballot
448
+ ## token first, then the base kept whole. The TYPE-token number is
449
+ ## space-bounded on both sides — mandatory trailing space — so
450
+ ## "PDAM 19973-2" cannot read 19973 as the ballot number: with no
451
+ ## second space the group backtracks and 19973 parses in second_part.
452
+ ballot_supplement_identifier = {
453
+ prefix_with_copublishers
454
+ [space]
455
+ [slash]
456
+ ballot_type_with_stage
457
+ [ space ((1*digit)) as ballot_number space ]
458
+ [space]
459
+ [type_with_stage]
460
+ [space]
461
+ second_part
462
+ [ ballot_stamp ]
463
+ }
464
+ ## The space-attached ballot face: "ISO 15877-5:2009 FDAM 1" — the
465
+ ## base designation first, then the ballot token attached by a space.
466
+ ## The base front is inlined (not supplement_base_no_third): that
467
+ ## rule ends in base_third_part_edition, whose own optional space
468
+ ## would consume the separator the ballot token needs. No base
469
+ ## edition is served here — none of the stored or owner-cited ballot
470
+ ## faces carries one.
471
+ ballot_space_supplement_identifier = {
472
+ [ (("Guide" / "GUIDE") as type_with_stage_fr) space ]
473
+ [prefix_with_copublishers]
474
+ [space]
475
+ [slash]
476
+ [type_with_stage]
477
+ [space]
478
+ second_part
479
+ space ballot_type_with_stage
480
+ [ space ((1*digit)) as ballot_number ]
481
+ }
482
+
398
483
  # ---- directives: "ISO/IEC DIR 1", "ISO/IEC JTC 1 DIR", supplements,
399
484
  # bundled "ISO/IEC DIR 1:2022 + IEC SUP:2022" ----
400
485
  directives_publisher_subgroup = ("JTC 1") as subgroup
@@ -609,7 +694,8 @@ grammar PubidIso version "0.4.0" edition 2 {
609
694
  }
610
695
 
611
696
  ## The ISO identifier root: common-text twin form first, then the
612
- ## single spine.
697
+ ## single spine. The historic ballot faces go last — purely additive
698
+ ## branches (an input an earlier member parses keeps that parse).
613
699
  identifier = {
614
700
  bare_tc_document
615
701
  / nsb_iso_identifier
@@ -623,6 +709,8 @@ grammar PubidIso version "0.4.0" edition 2 {
623
709
  / supplement_identifier
624
710
  / joint_identifier
625
711
  / identifier_copublishers
712
+ / ballot_space_supplement_identifier
713
+ / ballot_supplement_identifier
626
714
  }
627
715
 
628
716
  entry identifier: identifier
@@ -712,6 +800,12 @@ bs3_undated_marker -> bs3_undated_marker (string)
712
800
  idf_supp_stage_iteration2 -> idf_supp_stage_iteration2 (string)
713
801
  idf_supp_date2 -> idf_supp_date2 (string)
714
802
  idf_supp_undated_marker -> idf_supp_undated_marker (string)
803
+ ballot_type_with_stage -> ballot_type_with_stage (string)
804
+ ballot_number -> ballot_number (string)
805
+ ballot_stamp_number -> ballot_stamp_number (string)
806
+ ballot_stamp_dot_number -> ballot_stamp_dot_number (string)
807
+ ballot_stamp_date -> ballot_stamp_date (string)
808
+ ballot_stamp_undated_marker -> ballot_stamp_undated_marker (string)
715
809
  }
716
810
 
717
811
  ## In-file grammar tests: run at compile time, embedded in the artifact,
@@ -728,9 +822,55 @@ bs3_undated_marker -> bs3_undated_marker (string)
728
822
  accept "ISO 5537|IDF 26"
729
823
  accept "ISO 4055/Amd 1:2021"
730
824
  accept "ISO/R 9:1962"
825
+ accept "ISO/IEC FDAM 1 14496-12:2004"
826
+ accept "ISO/PDAM 19973-2"
827
+ accept "ISO/IEC FPDAM 9075/1"
828
+ accept "ISO/IEC FPDAM 10373-6/Amd 9:2001"
829
+ accept "ISO/PDAM 19110:2005/Amd.1"
830
+ accept "ISO/IEC PDAM TR 9573-11/Amd.1"
831
+ accept "ISO/IEC PDAM 9541-1/Amd.4"
832
+ accept "ISO/IEC PDAM 2 10646:2012"
833
+ accept "ISO 15877-5:2009 FDAM 1"
834
+ accept "ISO 19776-2:2005/Am1:2006"
731
835
  reject "nonsense"
836
+ reject "ISO/PDAM"
837
+ reject "ISO/FDAM"
732
838
  example "ISO/IEC WD TS 25025" { publisher: "ISO" }
733
839
  example "JCGM 200:2008(F)" { publisher: "JCGM" }
840
+ example "ISO/IEC FDAM 1 14496-12:2004" {
841
+ ballot_type_with_stage: "FDAM"
842
+ ballot_number: "1"
843
+ number_with_part: "14496-12"
844
+ date: "2004"
845
+ }
846
+ example "ISO/PDAM 19973-2" {
847
+ ballot_type_with_stage: "PDAM"
848
+ number_with_part: "19973-2"
849
+ }
850
+ example "ISO/IEC FPDAM 10373-6/Amd 9:2001" {
851
+ ballot_type_with_stage: "FPDAM"
852
+ ballot_stamp_number: "9"
853
+ ballot_stamp_date: "2001"
854
+ }
855
+ example "ISO/PDAM 19110:2005/Amd.1" {
856
+ ballot_type_with_stage: "PDAM"
857
+ ballot_stamp_number: "1"
858
+ }
859
+ example "ISO/IEC FPDAM 9075/1" {
860
+ ballot_type_with_stage: "FPDAM"
861
+ number_with_part: "9075/1"
862
+ }
863
+ example "ISO 15877-5:2009 FDAM 1" {
864
+ ballot_type_with_stage: "FDAM"
865
+ ballot_number: "1"
866
+ number_with_part: "15877-5"
867
+ date: "2009"
868
+ }
869
+ example "ISO/IEC FDAM 19776-2:2005/Am1:2006" {
870
+ ballot_type_with_stage: "FDAM"
871
+ ballot_stamp_number: "1"
872
+ ballot_stamp_date: "2006"
873
+ }
734
874
  }
735
875
  }
736
876