pubid 2.0.0.pre.alpha.37 → 2.0.0.pre.alpha.39

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aac2c57a1550852debb76008ce05c727b038be5f3aef996d62ec0147816605c9
4
- data.tar.gz: 765e2a70e25788b16a40756ba09aa2036092090d84573530b7817ec378c83838
3
+ metadata.gz: e53b03c87c2a04f877d8eba11d5689984de9c0af641258c68c8c03377d762f12
4
+ data.tar.gz: 5bdad1686cf8cd3709ea1494eef8c78dd7c6974bae2802ccc669db939f788731
5
5
  SHA512:
6
- metadata.gz: b635a5e6d5b648433fd716a99085f857ac73e1e926cbfc7b6b60e42ea5b65ec932f2f7510a836911774d9b471dc09835d7acfd771563e6af9a5fe01f731cfced
7
- data.tar.gz: f7273bf6f87c5b1679fe9a90e07b5656b672f53c9fc3124103cfb03a28737d70bfe8c5da86cfa10facd882363503f69523ad3fb1916ae534a60b77200ca2d593
6
+ metadata.gz: 822faa7030a35d1e87901785b0d22bb0716c1b997985c6b9d616c1eb75f3e7fe3436ca61c427c4d8abd44d14fe2e173b7a8c5ab3bc26941bb68e75f308862965
7
+ data.tar.gz: e636567ecb22497f4cf0c0cafdfe68d06f83e593bc15483c168cbc25053a61221d6738ac16730f2bbe0e05c88ce6d91bb3166da7386ac1ca4004363fea390a5a
@@ -155,7 +155,9 @@ ISO/IEC/IEEE CD P26513/D1, August 2015: ISO/IEC/IEEE P26513/D1, August 2015
155
155
  "ISO/IEC/IEEE DIS P16326/201x, December 2018": "ISO/IEC/IEEE DIS P16326-2018-12"
156
156
  "ISO/IEC/IEEE/P21839, 2019(E)": "ISO/IEC/IEEE P21839-2019"
157
157
  "ISO/IEC/IEEE CD2 P12207-2: 201x(E), February 2019": "ISO/IEC/IEEE CD2 P12207.2-2019-02"
158
- "ISO/IEC/IEEE P42010.WD4:2019(E)": "ISO/IEC/IEEE P42010/D-4-2019"
158
+ # The glued WD iteration re-spells to the face that canonicalises in one
159
+ # round ("P42010/D-4-2019" renders "P42010.2019/D4", a second round).
160
+ "ISO/IEC/IEEE P42010.WD4:2019(E)": "ISO/IEC/IEEE P42010.2019/D4"
159
161
  # the grammar parses the raw `_CDV/V3, Month YYYY` spelling directly
160
162
  # (joint_development_ieee_format slash-stage branch) — no shim needed
161
163
  "ISO/IEC/IEEE/P16085_DIS, March 2020": "ISO/IEC/IEEE DIS P16085-2020-03"
@@ -16,7 +16,7 @@ module Pubid
16
16
  "Jun" => "06", "Jul" => "07", "Aug" => "08", "Sep" => "09",
17
17
  "Oct" => "10", "Nov" => "11", "Dec" => "12",
18
18
  }.freeze
19
- attr_accessor :original_input
19
+ attr_accessor :original_input, :parser_input
20
20
  attr_reader :identifier_class
21
21
 
22
22
  def initialize(identifier_class = Identifier)
@@ -1535,10 +1535,12 @@ module Pubid
1535
1535
  type_value = "Std" if type_value == "Standard"
1536
1536
  draft_status_value = extract_value(parsed[:draft_status])
1537
1537
 
1538
- # Handle case where parser captured number without "P" prefix
1539
- # Check original input to see if there was a P before the number
1540
- # The ieee_p_identifier rule consumes P without capturing it
1541
- if !type_value && original_input&.match?(/IEEE\s+P/)
1538
+ # Handle case where parser captured number without "P" prefix.
1539
+ # The parser sees the NORMALIZED spelling: a rewrite that moves
1540
+ # the project P behind a re-spelled type word ("IEEE
1541
+ # PC37.30.2/D03 Rev 8" -> "IEEE Draft PC37.30.2Rev8/D03") must
1542
+ # not be re-read as a project marker from the raw input.
1543
+ if !type_value && parser_input&.match?(/IEEE\s+P/)
1542
1544
  type_value = "P"
1543
1545
  end
1544
1546
 
@@ -384,10 +384,12 @@ module Pubid
384
384
  result = PreParser.preprocess(normalized)
385
385
  return build_dual(result.parts) if result.dispatch == :dual_semicolon
386
386
  end
387
- parsed = Pubid::Parg::Backend.parse(:ieee, Parser.normalize_input(normalized))
387
+ parser_input = Parser.normalize_input(normalized)
388
+ parsed = Pubid::Parg::Backend.parse(:ieee, parser_input)
388
389
  builder = Builder.new(Identifier)
389
390
  # Pass the original input string to builder for context
390
391
  builder.original_input = input
392
+ builder.parser_input = parser_input
391
393
  builder.build(parsed)
392
394
  end
393
395
 
@@ -1295,6 +1295,60 @@ module Pubid
1295
1295
  # them to the generic standard face with a slashed copublisher.
1296
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')
1297
1297
  cleaned = cleaned.gsub(%r{(IEEE|ISO|IEC)//}, '\1/')
1298
+ # The three-way ISO-led list glues the language marker to the
1299
+ # year ("ISO/IEC/IEEE 8802-1AC-2018(E)"): the spaced spelling is
1300
+ # read as the language marker and dropped, the glued one falls
1301
+ # into parenthetical content and prints. Re-spell the boundary.
1302
+ # Scoped to the three-way lists: the two-way IEC/IEEE copublished
1303
+ # form keeps its glued (E) as identity ("…:2012(E)").
1304
+ cleaned = cleaned.gsub(
1305
+ %r{\A((?:ISO/IEC/IEEE|IEEE/ISO/IEC|IEEE/IEC/ISO)\s+[^()]+?[^()\s])\(E\)\z},
1306
+ '\1 (E)',
1307
+ )
1308
+ # The stage-first joint draft's dash part carries a bare comma
1309
+ # year ("IEC/IEEE FDIS P60780-323, 2015"): the joint route takes
1310
+ # no bare year there and the copublished route claims the string,
1311
+ # so drop the non-identity year and let the stage-first route
1312
+ # read the dash part (the rendered face is the dot human).
1313
+ cleaned = cleaned.gsub(
1314
+ %r{\A((?:IEC/IEEE|IEEE/IEC)\s+(?:FDIS|FCD|CDV|DIS|CD|WD|PWI|NP)\s+P\d+(?:-\d+)+),\s+\d{4}\z},
1315
+ '\1',
1316
+ )
1317
+ # A two-digit draft designator spelled without its D
1318
+ # ("IEEE P1052/08, September 2018"): the corpus face is the D
1319
+ # ordinal ("…/D08").
1320
+ cleaned = cleaned.gsub(
1321
+ %r{\AIEEE\s+(P[\d.-]+)/(\d{2}),\s+([A-Za-z]+)\s+(\d{4})\z},
1322
+ 'IEEE \1/D\2, \3 \4',
1323
+ )
1324
+ # The revision word rides after the draft ordinal
1325
+ # ("IEEE PC37.30.2/D03 Rev 8, October 2013"): move it onto the
1326
+ # number and mark the document as the draft it spells.
1327
+ cleaned = cleaned.gsub(
1328
+ %r{\AIEEE\s+((?:P)?C?[\d.]+)/D(\d+)\s+Rev\s+(\d+),\s+([A-Za-z]+)\s+(\d{4})\z},
1329
+ 'IEEE Draft \1Rev\3/D\2, \4 \5',
1330
+ )
1331
+ # The IEEE-led joint list's dash/underscore stage tail carries a
1332
+ # month-name date ("IEEE/ISO/IEC P29119-2-DIS, December 2011",
1333
+ # "IEEE/ISO/IEC P29119-4_FDIS, December 2020"). The generic route
1334
+ # claims it first and answers with a slashed copublisher
1335
+ # ("IEEE//ISO/IEC Draft …"), so re-spell the stage as the D=
1336
+ # designator the joint route reads. Scoped to the IEEE-led list:
1337
+ # the ISO/IEC- and IEC/IEEE-led forms already render the face.
1338
+ cleaned = cleaned.gsub(
1339
+ %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}
1340
+ ) do
1341
+ month = ::Pubid::Ieee::Builder::REV_MONTH_NUMBERS[
1342
+ Regexp.last_match(5).capitalize
1343
+ ]
1344
+ if month
1345
+ "#{Regexp.last_match(1)} #{Regexp.last_match(2)}/" \
1346
+ "D=#{Regexp.last_match(3)}#{Regexp.last_match(4)}-" \
1347
+ "#{Regexp.last_match(6)}#{month}"
1348
+ else
1349
+ Regexp.last_match(0)
1350
+ end
1351
+ end
1298
1352
  # The lettered REV spellings glue to the number ("P1310Rev3",
1299
1353
  # "P1722Rev1") or carry an after-word separator ("REV.ma",
1300
1354
  # "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.37"
4
+ VERSION = "2.0.0.pre.alpha.39"
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.37
4
+ version: 2.0.0.pre.alpha.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.