pubid 2.0.0.pre.alpha.19 → 2.0.0.pre.alpha.21

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.
@@ -347,6 +347,37 @@ module Pubid
347
347
  end
348
348
 
349
349
  # Route to appropriate identifier class based on content
350
+ # The bare-IEEE fdraft clause (pubid#203): a slash-led stage word
351
+ # after the code ("IEEE P15026.2/FDIS, August 2010") captures the
352
+ # stage and its date; route them onto the identifier exactly like
353
+ # the joint stage-first spelling so the lossless stage-word face
354
+ # renders them instead of silently dropping them (the drop was the
355
+ # deferred residue noted in Parser.normalize_input).
356
+ if parsed[:fdraft].is_a?(Hash)
357
+ fd = parsed[:fdraft]
358
+ fd_stage = extract_value(fd[:fdraft_stage])
359
+ if fd_stage
360
+ # An IEEE identifier carrying an ISO stage renders the IEEE
361
+ # designator face with the IEEE date convention:
362
+ # "IEEE P15026.2/D=FDIS-201008" (pubid#203 ruling). The
363
+ # stage and date ride the designator; the ISO face is not
364
+ # elected.
365
+ year = extract_value(fd[:year])
366
+ month = extract_value(fd[:month])
367
+ date = ""
368
+ if year
369
+ date = "-#{year}"
370
+ date += format("%02d", Date.parse(month.to_s).month) if month
371
+ end
372
+ # The date rides inside the designator ("-201008"); a bare
373
+ # year attribute would print a second, colon-joined date on
374
+ # the code ("P15026.2:2010/D=…").
375
+ attributes[:publishers] ||= [attributes[:publisher] || "IEEE"].compact
376
+ attributes[:ieee_draft] = "D=#{fd_stage}#{date}"
377
+ attributes[:typed_stage] = Pubid::Ieee.locate_stage(fd_stage)
378
+ end
379
+ end
380
+
350
381
  identifier_class = determine_identifier_class(attributes)
351
382
  rename_supplement_keys(attributes)
352
383
  identifier_class.new(**attributes)
@@ -786,12 +817,11 @@ module Pubid
786
817
  iter = extract_value(parsed[:draft_iso_iteration]).to_s.sub(/\A\./, "")
787
818
  joint_draft += ".#{iter}" unless iter.empty?
788
819
  end
789
- # The date rides inside the designator colon-joined
790
- # ("D=CDV:2020" — the standing joint_stage_draft_spec contract;
791
- # the dash spelling the grammar newly accepts is an alias that
792
- # normalizes to the colon face).
820
+ # The designator date joins verbatim: the grammar captures the
821
+ # separator with the value (":2020", "-2017", "-201008" — the
822
+ # IEEE date convention for an ISO-staged draft, pubid#203).
793
823
  if parsed[:draft_stage_year]
794
- joint_draft += ":#{extract_value(parsed[:draft_stage_year])}"
824
+ joint_draft += extract_value(parsed[:draft_stage_year]).to_s
795
825
  end
796
826
  attributes[:ieee_draft] = joint_draft
797
827
  end
@@ -859,26 +889,86 @@ module Pubid
859
889
  return Identifiers::Standard.new(**printed_attrs.compact)
860
890
  end
861
891
 
892
+ # The re-parse of the pubid#203 designator render ("IEEE
893
+ # P15026.2/D=FDIS-201008") captures the stage and the verbatim
894
+ # date token (":2020", "-201008") with no publisher slot; the
895
+ # designator is the IEEE face, so IEEE is the sole publisher.
896
+ if parsed[:iso_stage] && parsed[:draft_stage_year]
897
+ stage_word = extract_value(parsed[:iso_stage])
898
+ attributes[:publishers] ||= ["IEEE"]
899
+ attributes[:publisher] ||= "IEEE"
900
+ attributes[:copublisher] ||= []
901
+ attributes[:ieee_draft] =
902
+ "D=#{stage_word}#{extract_value(parsed[:draft_stage_year])}"
903
+ attributes[:typed_stage] = Pubid::Ieee.locate_stage(stage_word)
904
+ attributes[:lead_party] = "IEEE"
905
+ attributes.delete(:year)
906
+ attributes.delete(:month)
907
+ end
908
+
862
909
  # Detect lead party based on pattern
863
910
  if parsed[:iso_stage]
864
- # ISO stage word present: the reference is printed in the ISO
865
- # position ("IEEE FCD 15026.3:2010"), so it parses as printed
866
- # (pubid#469) - lead ISO, ISO face, whatever the publisher
867
- # order. The printed first publisher is not the arrangement, and
868
- # the published relaton-data-ieee rows carry lead ISO (pubid#477).
869
- attributes[:lead_party] = "ISO"
870
- attributes[:iso_stage] = extract_value(parsed[:iso_stage])
871
-
872
- # Create typed_stage for ISO stage
873
- stage_abbr = attributes[:iso_stage]
874
- if stage_abbr
875
- attributes[:typed_stage] =
876
- Pubid::Ieee.locate_stage(stage_abbr)
911
+ stage_abbr = extract_value(parsed[:iso_stage])
912
+ # The IEC "/V<version>" iteration rides glued onto the stage word
913
+ # ("_CDV/V3" -> "CDV3"), the family's lossless spelling ("DIS2",
914
+ # "CD4" - pubid#477).
915
+ if parsed[:iso_stage_iteration]
916
+ stage_abbr += extract_value(parsed[:iso_stage_iteration])
877
917
  end
918
+ bare_ieee_project = parsed[:project_marker] &&
919
+ attributes[:publisher] == "IEEE" &&
920
+ attributes[:copublisher] == []
921
+ if bare_ieee_project && parsed[:draft_stage_year].nil?
922
+ # pubid#203: a bare-IEEE project row carrying an ISO stage is
923
+ # an IEEE draft of joint ISO/IEC work ("IEEE FDIS P15026.2,
924
+ # August 2010"). The stage rides the IEEE designator with the
925
+ # IEEE date convention and the date rides inside the
926
+ # designator; the ISO stage-word face is not elected.
927
+ date = ""
928
+ if attributes[:year]
929
+ date = "-#{attributes[:year]}"
930
+ m = attributes[:month].to_s
931
+ unless m.empty?
932
+ month_num = m.match?(/\A\d+\z/) ? m.to_i : Date.parse(m).month
933
+ date += format("%02d", month_num)
934
+ end
935
+ end
936
+ attributes[:ieee_draft] = "D=#{stage_abbr}#{date}"
937
+ attributes[:typed_stage] = Pubid::Ieee.locate_stage(stage_abbr)
938
+ attributes[:lead_party] = "IEEE"
939
+ attributes.delete(:year)
940
+ attributes.delete(:month)
941
+ elsif !bare_ieee_project
942
+ # ISO stage word present: the reference is printed in the ISO
943
+ # position ("IEEE FCD 15026.3:2010"), so it parses as printed
944
+ # (pubid#469) - lead ISO, ISO face, whatever the publisher
945
+ # order. The printed first publisher is not the arrangement,
946
+ # and the published relaton-data-ieee rows carry lead ISO
947
+ # (pubid#477).
948
+ attributes[:lead_party] = "ISO"
949
+ attributes[:iso_stage] = stage_abbr
950
+
951
+ # Create typed_stage for ISO stage
952
+ if stage_abbr
953
+ attributes[:typed_stage] =
954
+ Pubid::Ieee.locate_stage(stage_abbr)
955
+ end
956
+ end
957
+ # bare_ieee_project with a designator date token: the block
958
+ # above already composed the D= designator (lead IEEE).
878
959
  elsif parsed[:iso_published]
879
- # Stage-less PUBLISHED joint form (pubid#317): ISO-led spelling,
880
- # no project marker, no typed stage - renders as printed.
881
- attributes[:lead_party] = "ISO"
960
+ if parsed[:draft_iso_stage] && attributes[:publisher] == "IEEE" &&
961
+ attributes[:copublisher] == []
962
+ # The re-parse of the pubid#203 designator render ("IEEE
963
+ # P15026.2/D=FDIS-201008") lands here: bare IEEE publishers,
964
+ # the stage on the D= designator - lead IEEE, not ISO.
965
+ attributes[:lead_party] = "IEEE"
966
+ else
967
+ # Stage-less PUBLISHED joint form (pubid#317): ISO-led
968
+ # spelling, no project marker, no typed stage - renders as
969
+ # printed.
970
+ attributes[:lead_party] = "ISO"
971
+ end
882
972
  else
883
973
  # IEEE format - lead party is IEEE
884
974
  attributes[:lead_party] = "IEEE"
@@ -1012,6 +1102,15 @@ module Pubid
1012
1102
  return Ieee::Aiee::Identifier
1013
1103
  end
1014
1104
 
1105
+ # A stage-bearing row is a joint development whatever its type
1106
+ # code: the stage is the printed identity ("IEEE P15026.2/FDIS",
1107
+ # pubid#203) and only JointDevelopment carries iso_stage and the
1108
+ # D= designator.
1109
+ if attributes[:iso_stage] ||
1110
+ attributes[:ieee_draft].to_s.start_with?("D=")
1111
+ return Identifiers::JointDevelopment
1112
+ end
1113
+
1015
1114
  # Get type from attributes and use flavor module to locate class
1016
1115
  type_code = attributes[:type]
1017
1116
 
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.0.pre.alpha.19"
4
+ VERSION = "2.0.0.pre.alpha.21"
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.0.pre.alpha.19
4
+ version: 2.0.0.pre.alpha.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.