pubid 2.0.0.pre.alpha.19 → 2.0.0.pre.alpha.20
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/ieee.json +1 -1
- data/lib/pubid/ieee/builder.rb +114 -21
- data/lib/pubid/version.rb +1 -1
- metadata +1 -1
data/lib/pubid/ieee/builder.rb
CHANGED
|
@@ -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
|
|
790
|
-
# ("
|
|
791
|
-
#
|
|
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 +=
|
|
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,80 @@ 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
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
attributes[:
|
|
876
|
-
|
|
911
|
+
stage_abbr = extract_value(parsed[:iso_stage])
|
|
912
|
+
bare_ieee_project = parsed[:project_marker] &&
|
|
913
|
+
attributes[:publisher] == "IEEE" &&
|
|
914
|
+
attributes[:copublisher] == []
|
|
915
|
+
if bare_ieee_project && parsed[:draft_stage_year].nil?
|
|
916
|
+
# pubid#203: a bare-IEEE project row carrying an ISO stage is
|
|
917
|
+
# an IEEE draft of joint ISO/IEC work ("IEEE FDIS P15026.2,
|
|
918
|
+
# August 2010"). The stage rides the IEEE designator with the
|
|
919
|
+
# IEEE date convention and the date rides inside the
|
|
920
|
+
# designator; the ISO stage-word face is not elected.
|
|
921
|
+
date = ""
|
|
922
|
+
if attributes[:year]
|
|
923
|
+
date = "-#{attributes[:year]}"
|
|
924
|
+
m = attributes[:month].to_s
|
|
925
|
+
unless m.empty?
|
|
926
|
+
month_num = m.match?(/\A\d+\z/) ? m.to_i : Date.parse(m).month
|
|
927
|
+
date += format("%02d", month_num)
|
|
928
|
+
end
|
|
929
|
+
end
|
|
930
|
+
attributes[:ieee_draft] = "D=#{stage_abbr}#{date}"
|
|
931
|
+
attributes[:typed_stage] = Pubid::Ieee.locate_stage(stage_abbr)
|
|
932
|
+
attributes[:lead_party] = "IEEE"
|
|
933
|
+
attributes.delete(:year)
|
|
934
|
+
attributes.delete(:month)
|
|
935
|
+
elsif !bare_ieee_project
|
|
936
|
+
# ISO stage word present: the reference is printed in the ISO
|
|
937
|
+
# position ("IEEE FCD 15026.3:2010"), so it parses as printed
|
|
938
|
+
# (pubid#469) - lead ISO, ISO face, whatever the publisher
|
|
939
|
+
# order. The printed first publisher is not the arrangement,
|
|
940
|
+
# and the published relaton-data-ieee rows carry lead ISO
|
|
941
|
+
# (pubid#477).
|
|
942
|
+
attributes[:lead_party] = "ISO"
|
|
943
|
+
attributes[:iso_stage] = stage_abbr
|
|
944
|
+
|
|
945
|
+
# Create typed_stage for ISO stage
|
|
946
|
+
if stage_abbr
|
|
947
|
+
attributes[:typed_stage] =
|
|
948
|
+
Pubid::Ieee.locate_stage(stage_abbr)
|
|
949
|
+
end
|
|
877
950
|
end
|
|
951
|
+
# bare_ieee_project with a designator date token: the block
|
|
952
|
+
# above already composed the D= designator (lead IEEE).
|
|
878
953
|
elsif parsed[:iso_published]
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
954
|
+
if parsed[:draft_iso_stage] && attributes[:publisher] == "IEEE" &&
|
|
955
|
+
attributes[:copublisher] == []
|
|
956
|
+
# The re-parse of the pubid#203 designator render ("IEEE
|
|
957
|
+
# P15026.2/D=FDIS-201008") lands here: bare IEEE publishers,
|
|
958
|
+
# the stage on the D= designator - lead IEEE, not ISO.
|
|
959
|
+
attributes[:lead_party] = "IEEE"
|
|
960
|
+
else
|
|
961
|
+
# Stage-less PUBLISHED joint form (pubid#317): ISO-led
|
|
962
|
+
# spelling, no project marker, no typed stage - renders as
|
|
963
|
+
# printed.
|
|
964
|
+
attributes[:lead_party] = "ISO"
|
|
965
|
+
end
|
|
882
966
|
else
|
|
883
967
|
# IEEE format - lead party is IEEE
|
|
884
968
|
attributes[:lead_party] = "IEEE"
|
|
@@ -1012,6 +1096,15 @@ module Pubid
|
|
|
1012
1096
|
return Ieee::Aiee::Identifier
|
|
1013
1097
|
end
|
|
1014
1098
|
|
|
1099
|
+
# A stage-bearing row is a joint development whatever its type
|
|
1100
|
+
# code: the stage is the printed identity ("IEEE P15026.2/FDIS",
|
|
1101
|
+
# pubid#203) and only JointDevelopment carries iso_stage and the
|
|
1102
|
+
# D= designator.
|
|
1103
|
+
if attributes[:iso_stage] ||
|
|
1104
|
+
attributes[:ieee_draft].to_s.start_with?("D=")
|
|
1105
|
+
return Identifiers::JointDevelopment
|
|
1106
|
+
end
|
|
1107
|
+
|
|
1015
1108
|
# Get type from attributes and use flavor module to locate class
|
|
1016
1109
|
type_code = attributes[:type]
|
|
1017
1110
|
|
data/lib/pubid/version.rb
CHANGED