pubid 2.0.0.pre.alpha.36 → 2.0.0.pre.alpha.38

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.
@@ -1137,13 +1137,18 @@ module Pubid
1137
1137
  # P15026.2/D=FDIS-201008") captures the stage and the verbatim
1138
1138
  # date token (":2020", "-201008") with no publisher slot; the
1139
1139
  # designator is the IEEE face, so IEEE is the sole publisher.
1140
- if parsed[:iso_stage] && parsed[:draft_stage_year]
1140
+ # The no-year form ("IEEE P12207/D=CD1") rides the same D=
1141
+ # designator when the stage carries the glued iteration digit —
1142
+ # the token boundary only the designation route produces.
1143
+ if parsed[:iso_stage] && (parsed[:draft_stage_year] ||
1144
+ (original_input.to_s.include?("/D=") &&
1145
+ extract_value(parsed[:iso_stage]).to_s.match?(/\A[A-Z]+\d\z/)))
1141
1146
  stage_word = extract_value(parsed[:iso_stage])
1142
1147
  attributes[:publishers] ||= ["IEEE"]
1143
1148
  attributes[:publisher] ||= "IEEE"
1144
1149
  attributes[:copublisher] ||= []
1145
1150
  attributes[:ieee_draft] =
1146
- "D=#{stage_word}#{extract_value(parsed[:draft_stage_year])}"
1151
+ "D=#{stage_word}#{extract_value(parsed[:draft_stage_year]).to_s}"
1147
1152
  attributes[:typed_stage] = Pubid::Ieee.locate_stage(stage_word)
1148
1153
  attributes[:lead_party] = "IEEE"
1149
1154
  attributes.delete(:year)
@@ -664,10 +664,12 @@ module Pubid
664
664
  str("ISO/IEC") | str("IEEE"))
665
665
  # ISO stage codes: FDIS, FCD, CDV; DIS/CD with an optional round
666
666
  # digit (DIS2, CD1..CD4); WD/PWI/NP.
667
- iso_stage = (str("FDIS") | str("FCD") | str("CDV") |
667
+ iso_stage = ((str("FDIS") >> digit.maybe) | (str("FCD") >> digit.maybe) |
668
+ (str("CDV") >> digit.maybe) |
668
669
  (str("DIS") >> digit.maybe) |
669
670
  (str("CD") >> digit.maybe) |
670
- str("WD") | str("PWI") | str("NP")).as(:iso_stage)
671
+ (str("WD") >> digit.maybe) | (str("PWI") >> digit.maybe) |
672
+ (str("NP") >> digit.maybe)).as(:iso_stage)
671
673
  std_noise = (space >> str("Std")).maybe
672
674
  # The empty-string marker distinguishes the stage-less PUBLISHED
673
675
  # tree in the builder (absence of :iso_stage alone means IEEE format).
@@ -719,10 +721,12 @@ module Pubid
719
721
  # D (draft) = the ISO/IEC stage it drafts, with its iteration
720
722
  # (docs/IEEE-DRAFT-STAGES.md §1.2).
721
723
  ((slash >> str("D") >> str("=") >>
722
- (str("FDIS") | str("FCD") | str("CDV") |
724
+ ((str("FDIS") >> digit.maybe) | (str("FCD") >> digit.maybe) |
725
+ (str("CDV") >> digit.maybe) |
723
726
  (str("DIS") >> digit.maybe) |
724
727
  (str("CD") >> digit.maybe) |
725
- str("WD") | str("PWI") | str("NP")).as(:draft_iso_stage) >>
728
+ (str("WD") >> digit.maybe) | (str("PWI") >> digit.maybe) |
729
+ (str("NP") >> digit.maybe)).as(:draft_iso_stage) >>
726
730
  (dot >> (digits >> match("[A-Za-z]").repeat(0, 1)).as(:draft_iso_iteration)).maybe) |
727
731
  (slash >> str("D") >> dash.maybe >>
728
732
  match('[0-9.]').repeat(1).as(:draft_version) >>
@@ -806,10 +810,12 @@ module Pubid
806
810
  # can't match inside a longer token and a glued no-space date
807
811
  # (".DISMay2013") is left to fall through.
808
812
  dot >>
809
- (str("FDIS") | str("FCD") | str("CDV") |
813
+ ((str("FDIS") >> digit.maybe) | (str("FCD") >> digit.maybe) |
814
+ (str("CDV") >> digit.maybe) |
810
815
  (str("DIS") >> digit.maybe) |
811
816
  (str("CD") >> digit.maybe) |
812
- str("WD") | str("PWI") | str("NP")).as(:iso_stage) >>
817
+ (str("WD") >> digit.maybe) | (str("PWI") >> digit.maybe) |
818
+ (str("NP") >> digit.maybe)).as(:iso_stage) >>
813
819
  (digit | match("[A-Za-z]")).absent? >>
814
820
  # optional trailing date: :YYYY, -YYYY[-MM], or text "Month YYYY"
815
821
  (
@@ -1289,6 +1295,27 @@ module Pubid
1289
1295
  # them to the generic standard face with a slashed copublisher.
1290
1296
  cleaned = cleaned.gsub(%r{((?:IEEE|ISO|IEC)(?:/(?:IEEE|ISO|IEC|CSA))+)\s+Draft\s+(P[A-Z0-9][A-Z0-9.-]*/D=[A-Z])}, '\1 \2')
1291
1297
  cleaned = cleaned.gsub(%r{(IEEE|ISO|IEC)//}, '\1/')
1298
+ # The IEEE-led joint list's dash/underscore stage tail carries a
1299
+ # month-name date ("IEEE/ISO/IEC P29119-2-DIS, December 2011",
1300
+ # "IEEE/ISO/IEC P29119-4_FDIS, December 2020"). The generic route
1301
+ # claims it first and answers with a slashed copublisher
1302
+ # ("IEEE//ISO/IEC Draft …"), so re-spell the stage as the D=
1303
+ # designator the joint route reads. Scoped to the IEEE-led list:
1304
+ # the ISO/IEC- and IEC/IEEE-led forms already render the face.
1305
+ cleaned = cleaned.gsub(
1306
+ %r{\A(IEEE(?:/(?:IEEE|ISO|IEC)){2,})\s+(P[A-Z0-9][A-Z0-9.-]*?)[-_](FDIS|FCD|CDV|DIS|CD|WD|PWI|NP)(\d*),\s+([A-Za-z]+)\s+(\d{4})\z}
1307
+ ) do
1308
+ month = ::Pubid::Ieee::Builder::REV_MONTH_NUMBERS[
1309
+ Regexp.last_match(5).capitalize
1310
+ ]
1311
+ if month
1312
+ "#{Regexp.last_match(1)} #{Regexp.last_match(2)}/" \
1313
+ "D=#{Regexp.last_match(3)}#{Regexp.last_match(4)}-" \
1314
+ "#{Regexp.last_match(6)}#{month}"
1315
+ else
1316
+ Regexp.last_match(0)
1317
+ end
1318
+ end
1292
1319
  # The lettered REV spellings glue to the number ("P1310Rev3",
1293
1320
  # "P1722Rev1") or carry an after-word separator ("REV.ma",
1294
1321
  # "REV-ma"); the rev rules read a space or a bare word
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.36"
4
+ VERSION = "2.0.0.pre.alpha.38"
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.36
4
+ version: 2.0.0.pre.alpha.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.