pubid 2.0.0.pre.alpha.38 → 2.0.0.pre.alpha.40

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: e167bcdea8ccdc856546623449ce7ecb5662e48105794db9f36026b8d577f300
4
- data.tar.gz: fdc189199738c34551faa29b7aa7abf0ccbdc006ef9aa5c1ae62b3f404b64cce
3
+ metadata.gz: c1e4c5a6889f61e535b4d05517aff5798eb5307c79bf7e318ab21822ebfe73ae
4
+ data.tar.gz: f129c70c4c9c646318c58e12d7a5e1097299c5698a083a0710e2866a2e7ad692
5
5
  SHA512:
6
- metadata.gz: bd79b71b7fd2b457d78f225d3cc37eb2280a56b32aa24e604b14d8aa66f4f14812915d960769c4c69668f8c5b6b17d67f24399683c4e4dd6f0dd84b5ca882bd8
7
- data.tar.gz: b0ce6c4e2d05416fc0ec1f77a29291bce32380efd13162ff62406bff78a60dc77c0b5404f3b61f036d868bc6b1f2c84003961cc6710b45ac0712facf6b972355
6
+ metadata.gz: d2e7e5cea5f0749a2aa5715521a2d6c192b43395bcb9f72470207629f6e7d1f0b9a7dbb089a1cc8e23c41a6ffc61a1e1424ce2546618249ed3eb074d611b3e4f
7
+ data.tar.gz: c4ee9f3166fa9caffb6f3b85d4684c11b6f08ac615ecf302af94831a9e7538a29264c2a862ffefa161fbeb4dbabc11b82405730c2435d5d666ab42c257fe2a61
@@ -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
 
@@ -1760,6 +1762,7 @@ module Pubid
1760
1762
  end
1761
1763
 
1762
1764
  # Check for specific draft notation (D1, D2, etc.)
1765
+ draft_version_present = false
1763
1766
  if parsed[:draft]
1764
1767
  draft_data = parsed[:draft]
1765
1768
  if draft_data.is_a?(Array)
@@ -1767,8 +1770,12 @@ module Pubid
1767
1770
  r.merge(e)
1768
1771
  end
1769
1772
  end
1773
+ # A verbatim draft designator ("/D2.1.1") is a version in itself;
1774
+ # only an attribute-less date hash ("{month:, year:}") lacks one.
1775
+ draft_version_present = true unless draft_data.is_a?(Hash)
1770
1776
 
1771
1777
  if draft_data.is_a?(Hash) && draft_data[:draft_version]
1778
+ draft_version_present = true
1772
1779
  dv = draft_data[:draft_version]
1773
1780
  version = if dv.is_a?(Array)
1774
1781
  dv.map do |v|
@@ -1779,6 +1786,21 @@ module Pubid
1779
1786
  end
1780
1787
 
1781
1788
  if version
1789
+ # A draft version that IS an ISO stage token ("/DCD1" and
1790
+ # "/CD1" both capture version "CD1") takes that stage on a
1791
+ # PLAIN IEEE document: the stage token outranks the ordinal
1792
+ # ladder (docs/IEEE-DRAFT-STAGES.md §1.3, "DDIS" = DIS), so
1793
+ # the render drops the Draft word. A joint ISO-led
1794
+ # stage-word draft keeps its generic project stage — its
1795
+ # publishers block composes the same face through the
1796
+ # typed-stage project branch.
1797
+ copubs = parsed[:publishers].is_a?(Hash) ? parsed[:publishers][:copublishers] : nil
1798
+ joint = copubs && !(copubs.respond_to?(:empty?) ? copubs.empty? : copubs.nil?)
1799
+ if !joint &&
1800
+ (m = version.to_s.match(/\A(FDIS|FCD|CDV|DIS|CD|WD|PWI|NP)\d*\z/))
1801
+ return m[1]
1802
+ end
1803
+
1782
1804
  # relaton's hyphenated "/D-2" spelling captures the dash inside
1783
1805
  # draft_version; the stage registry keys on "D2". A date-embedded
1784
1806
  # version ("3-2017-07") keys on its leading ordinal.
@@ -1800,13 +1822,17 @@ module Pubid
1800
1822
  return "P"
1801
1823
  elsif type_value == "Std"
1802
1824
  return "Std"
1803
- elsif type_value == "Draft Std" && parsed[:draft].nil? && parsed[:digit_draft].nil?
1825
+ elsif type_value == "Draft Std" && !draft_version_present && parsed[:digit_draft].nil?
1804
1826
  # A version-less "Draft Std" fabricates /D1 (issue #205);
1805
1827
  # deriving the stage from that fabricated version renders the
1806
1828
  # same P-prefixed form as an explicit "/D1" spelling, so the
1807
1829
  # render reaches its fixed point in one round (pubid#318).
1808
- # Gated on no-draft: a dotted version ("D2.0") fails the registry
1809
- # lookup above and must fall through, keeping "Draft Std".
1830
+ # Gated on no captured VERSION: a dotted version ("D2.0")
1831
+ # fails the registry lookup above and must fall through,
1832
+ # keeping "Draft Std". A draft-version-less tree that carries
1833
+ # only a date ("IEEE Draft Std P754/D1.2.6 Nov 2006") takes
1834
+ # the same fabricated D1, the version the render already
1835
+ # implies.
1810
1836
  return "D1"
1811
1837
  elsif type_value.match?(/^No\.?$/)
1812
1838
  return type_value
@@ -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,39 @@ 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
+ )
1298
1331
  # The IEEE-led joint list's dash/underscore stage tail carries a
1299
1332
  # month-name date ("IEEE/ISO/IEC P29119-2-DIS, December 2011",
1300
1333
  # "IEEE/ISO/IEC P29119-4_FDIS, December 2020"). The generic route
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.38"
4
+ VERSION = "2.0.0.pre.alpha.40"
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.38
4
+ version: 2.0.0.pre.alpha.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.