relaton-ieee 1.14.1 → 1.14.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecd6d92c4f49a3d402a3017e8ead935cdec59b22f7128271197ad5de76e1e696
4
- data.tar.gz: 6207e47442ff412f346f9e66dedf1392fec101ffa769b4d12fcacdd24ac26237
3
+ metadata.gz: 7bfe7ef194e55f3addf452b541108489d6644ea9154ef42929f1a0938ca0e033
4
+ data.tar.gz: 0ae803213616ca33af5f0c74d6831f589878b245fdd4e582c56ae88bf34e829d
5
5
  SHA512:
6
- metadata.gz: d924147453cfda65ac27b54776ba87f1be72ec829fee2d23f02fea8f437073c5fb35b431f86aee3fc632f7395000ee34eabd22970faef5958c7a1c98f25684ef
7
- data.tar.gz: 86fdff381a43369391442b99959a5281f1b988cbfa48db37b2d277c2333888d76e533d1a6fccc6d31c9b839680be6e6047dc7338bffca957688a577ab6794c67
6
+ metadata.gz: fc6b26efacc42e33e7e33c72fc6869f6ebfb7a9ad462a740417bc6c1612a6323a528306e90eec45955b5a3a33ae78a6b1497edecba04f79b0bfc8349e87416bf
7
+ data.tar.gz: 6e1a690eb15bde7f092f46d6cc0b9516eb6b9bf769fa266de9ac0025471a5932ee4910b9106d3cdbc7ab931ce8b04da2e31f28059c395aaea16e30cf3a093928
@@ -101,7 +101,7 @@ module RelatonIeee
101
101
  # nt = doc&.at("./normtitle")&.text
102
102
  # ntid = @normtitles.index nt
103
103
  # @normtitles << nt if nt && !ntid
104
- warn "Zero standard_id in #{filename}"
104
+ # warn "Zero standard_id in #{filename}"
105
105
  return
106
106
  end
107
107
  bib = DataParser.parse doc, self
@@ -74,16 +74,17 @@ module RelatonIeee
74
74
  #
75
75
  # @return [Array<RelatonBib::BibliographicDate>]
76
76
  #
77
- def parse_date # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
77
+ def parse_date # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
78
78
  dates = doc.xpath("./volume/article/articleinfo/date").map do |d|
79
79
  da = [d.at("./year").text]
80
80
  m = d.at("./month")&.text
81
81
  if m
82
- month = Date::ABBR_MONTHNAMES.index(m.sub(/\./, "")) || m
82
+ /^(?:(?<day>\d{1,2})\s)?(?<mon>\w+)/ =~ m
83
+ month = Date::ABBR_MONTHNAMES.index(mon) || m
83
84
  da << month.to_s.rjust(2, "0")
84
85
  end
85
- day = d.at("./day")
86
- da << day.text.rjust(2, "0") if day
86
+ day = d.at("./day")&.text || day
87
+ da << day.rjust(2, "0") if day
87
88
  on = da.compact.join "-"
88
89
  RelatonBib::BibliographicDate.new type: DATETYPES[d[:datetype]], on: on
89
90
  end
@@ -135,8 +136,9 @@ module RelatonIeee
135
136
  #
136
137
  def pubid
137
138
  @pubid ||= begin
138
- nt = doc.at("./normtitle").text
139
- RawbibIdParser.parse(nt)
139
+ normtitle = doc.at("./normtitle").text
140
+ stdnumber = doc.at("./publicationinfo/stdnumber")&.text
141
+ RawbibIdParser.parse(normtitle, stdnumber)
140
142
  end
141
143
  end
142
144
 
@@ -228,8 +230,12 @@ module RelatonIeee
228
230
  # @return [RelatonBib::DocumentStatus]
229
231
  #
230
232
  def parse_status
231
- stage = doc.at("./publicationinfo/standard_status").text.downcase
232
- stage.sub!("active", "approved").sub! "inactive", "withdrawn"
233
+ st = doc.at("./publicationinfo/standard_status").text.downcase
234
+ stage = case st
235
+ when "active" then "approved"
236
+ when "inactive" then "withdrawn"
237
+ else st
238
+ end
233
239
  DocumentStatus.new stage: stage
234
240
  end
235
241
 
@@ -1,7 +1,7 @@
1
1
  module RelatonIeee
2
2
  class DocumentStatus < RelatonBib::DocumentStatus
3
3
  class Stage < RelatonBib::DocumentStatus::Stage
4
- STAGES = %w[developing active inactive].freeze
4
+ STAGES = %w[draft approved superseded withdrawn].freeze
5
5
 
6
6
  def initialize(value:, abbreviation: nil)
7
7
  unless STAGES.include?(value.downcase)
@@ -7,7 +7,7 @@ module RelatonIeee
7
7
  def initialize # rubocop:disable Lint/MissingSuper
8
8
  @short = :relaton_ieee
9
9
  @prefix = "IEEE"
10
- @defaultprefix = %r{^IEEE\s}
10
+ @defaultprefix = %r{^(?:ANSI/)?IEEE\s}
11
11
  @idtype = "IEEE"
12
12
  @datasets = %w[ieee-rawbib]
13
13
  end
@@ -5,17 +5,18 @@ module RelatonIeee
5
5
  STAGES = 'DIS\d?|PSI|FCD|FDIS|CD\d?|Pub2|CDV|TS|SI'.freeze
6
6
  APPROVAL = '(?:\s(Unapproved|Approved))'.freeze
7
7
  APPROV = '(?:\s(?:Unapproved|Approved))?'.freeze
8
- STD = "(?:\s(?i)Std\.?(?-i))?".freeze
8
+ STD = "(?:\s(?i)Std.?(?-i))?".freeze
9
9
 
10
10
  #
11
11
  # Parse normtitle
12
12
  #
13
- # @param [String] normtitle <description>
13
+ # @param [String] normtitle document element "normtitle"
14
+ # @param [String] stdnumber document element "stdnumber"
14
15
  #
15
16
  # @return [RelatonIeee::PubId, nil]
16
17
  #
17
- def parse(normtitle) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
18
- case normtitle
18
+ def parse(normtitle, stdnumber) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
19
+ case normtitle.sub(/^ISO\s(?=\/)/, "ISO").sub(/^ANSI\/\s(?=IEEE)/, "ANSI/")
19
20
  # when "2012 NESC Handbook, Seventh Edition" then "NESC HBK ED7.2012"
20
21
  # when "2017 NESC(R) Handbook, Premier Edition" then "NESC HBK ED1.2017"
21
22
  # when "2017 National Electrical Safety Code(R) (NESC(R)) - Redline" then "NESC C2R.2017"
@@ -31,7 +32,7 @@ module RelatonIeee
31
32
  when "IEEE P802.1Qbu/03.0, July 2015" # "IEEE P802.1Qbu/D3.0.2015"
32
33
  PubId.new(publisher: "IEEE", number: "P802", part: "1Qbu", draft: "3.0", year: "2015")
33
34
  when "IEEE P11073-10422/04, November 2015" # "IEEE P11073-10422/D04.2015"
34
- PubId.new(publiisher: "IEEE", number: "P11073", part: "10422", draft: "04", year: "2015")
35
+ PubId.new(publisher: "IEEE", number: "P11073", part: "10422", draft: "04", year: "2015")
35
36
  when "IEEE P802.11aqTM/013.0 October 2017" # "IEEE P802-11aqTM/D13.0.2017"
36
37
  PubId.new(publisher: "IEEE", number: "P802", part: "11aqTM", draft: "13.0", year: "2017")
37
38
  when "IEEE P844.3/C22.2 293.3/D0, August 2018" # "IEEE P844-3/C22.2-293.3/D0.2018"
@@ -53,7 +54,7 @@ module RelatonIeee
53
54
  when "IEEE-P15026-3-DIS-January 2015" # "IEEE DIS P15026-3.2015"
54
55
  PubId.new(publisher: "IEEE", stage: "DIS", number: "P15026", year: "2015")
55
56
  when "ANSI/IEEE PC63.7/D rev17, December 2014" # "ANSI/IEEE PC63-7/D/REV-17.2014"
56
- PubId.new(publusher: "ANSI/IEEE", number: "PC63", part: "7", draft: "", rev: "17", year: "2014")
57
+ PubId.new(publisher: "ANSI/IEEE", number: "PC63", part: "7", draft: "", rev: "17", year: "2014")
57
58
  when "IEC/IEEE P62271-37-013:2015 D13.4" # "IEC/IEEE P62271-37-013/D13.4.2015"
58
59
  PubId.new(publisher: "IEC/IEEE", number: "P62271", part: "37-013", draft: "13.4", year: "2015")
59
60
  when "PC37.30.2/D043 Rev 18, May 2015" # "IEEE PC37-30-2/D043/REV-18.2015"
@@ -63,7 +64,7 @@ module RelatonIeee
63
64
  when "ISO/IEC/IEEE P15289:2016, 3rd Ed FDIS/D2" # "ISO/IEC/IEEE FDIS P15289/E3/D2.2016"
64
65
  PubId.new(publisher: "ISO/IEC/IEEE", stage: "FDIS", number: "P15289", part: "", edition: "3", draft: "2", year: "2016")
65
66
  when "IEEE P802.15.4REVi/D09, April 2011 (Revision of IEEE Std 802.15.4-2006)"
66
- PubId.new(publisher: "IEEE", number: "P802", part: "15.4", rev: "i", draft: "09", year: "2013", month: "04", approval: true)
67
+ PubId.new(publisher: "IEEE", number: "P802", part: "15.4", rev: "i", draft: "09", year: "2013", month: "04", approval: "Approved")
67
68
  when "Draft IEEE P802.15.4REVi/D09, April 2011 (Revision of IEEE Std 802.15.4-2006)"
68
69
  PubId.new(publisher: "IEEE", number: "P802", part: "15.4", rev: "i", draft: "09", year: "2011", month: "04")
69
70
  when "ISO/IEC/IEEE DIS P42020:201x(E), June 2017"
@@ -92,27 +93,35 @@ module RelatonIeee
92
93
  PubId.new(publisher: "ISO/IEC/IEEE", number: "P42010", draft: "4", year: "2019")
93
94
  when "IEC/IEEE P63195_CDV/V3, February 2020"
94
95
  PubId.new(publisher: "IEC/IEEE", number: "P63195", stage: "CDV", year: "2020", month: "02")
95
- when "ISO /IEC/IEEE P24774_D1, February 2020"
96
- PubId.new(publisher: "ISO/IEC/IEEE", number: "P24774", draft: "1", year: "2020", month: "02")
97
96
  when "IEEE/ISO/IEC P42010.CD1-V1.0, April 2020"
98
97
  PubId.new(publisher: "IEEE/ISO/IEC", number: "P42010", stage: "CD1", year: "2020", month: "04")
99
98
  when "ISO/IEC/IEEE/P16085_DIS, March 2020"
100
99
  PubId.new(publisher: "ISO/IEC/IEEE", stage: "DIS", number: "P16085", year: "2020", month: "03")
101
- when "ISO /IEC/IEEE P24774/DIS, July 2020"
102
- PubId.new(publisher: "ISO/IEC/IEEE", stage: "DIS", number: "P24774", year: "2020", month: "07")
103
- when "ANSI/ IEEE C37.23-1969" then PubId.new(publisher: "ANSI/IEEE", number: "C37", part:"23", year: "1969")
104
100
  when "ANSI/IEEE Std: Outdoor Apparatus Bushings"
105
101
  PubId.new(publisher: "ANSI/IEEE", number: "21", year: "1976", month: "11")
106
- when "ANSI/ IEEE C37.5-1979" then PubId.new(publisher: "ANSI/IEEE", number: "C37", part:"5", year: "1979")
107
102
  when "Unapproved Draft Std ISO/IEC FDIS 15288:2007(E) IEEE P15288/D3,"
108
103
  PubId.new(publisher: "ISO/IEC/IEEE", stage: "FDIS", number: "P15288", draft: "3", year: "2007")
109
104
  when "Draft National Electrical Safety Code, January 2016"
110
105
  PubId.new(publisher: "IEEE", number: "PC2", year: "2016", month: "01")
111
- when "ANSI/ IEEE C62.1-1981 (Revision of IEEE Std 28-1974 and ANSI C62.1-1975)"
112
- PubId.new(publisher: "ANSI/IEEE", number: "C62", part: "1", year: "1981")
113
106
  when "ANSI/IEEE-ANS-7-4.3.2-1982" then PubId.new(publisher: "ANSI/IEEE/ANS", number: "7", part: "4-3-2", year: "1982")
114
107
  when "IEEE Unapproved Draft Std P802.1AB/REVD2.2, Dec 2007" # "IEEE P802.1AB/REV/D2.2.2007"
115
108
  PubId.new(publisher: "IEEE", number: "P802", part: "1AB", rev: "", draft: "2.2", year: "2007", month: "12")
109
+ when "International Standard ISO/IEC 8802-9: 1996(E) ANSI/IEEE Std 802.9, 1996 Edition"
110
+ PubId.new(publisher: "ISO/IEC/IEEE", number: "802", part: "9", year: "1996")
111
+ when "ISO/IEC13210: 1994 (E) ANSI/IEEE Std 1003.3-1991"
112
+ PubId.new(publisher: "ISO/IEC/IEEE", number: "13210", year: "1994")
113
+ when "J-STD-016-1995" then PubId.new(publisher: "IEEE", number: "016", year: "1995")
114
+ when "Std 802.1ak-2007 (Amendment to IEEE Std 802.1QTM-2005)"
115
+ PubId.new(publisher: "IEEE", number: "802", part: "1ak", year: "2007")
116
+ when "IS0/IEC/IEEE 8802-11:2012/Amd.5:2015(E) (Adoption of IEEE Std 802.11af-2014)"
117
+ PubId.new(publisher: "ISO/IEC/IEEE", number: "802", part: "11", year: "2012", amd: "5", year_amendment: "2015")
118
+ when "National Electrical Safety Code, C2-2012 - Redline"
119
+ PubId.new(publisher: "IEEE", number: "C2", year: "2012", redline: "true")
120
+ when "National Electrical Safety Code, C2-2012" then PubId.new(publisher: "IEEE", number: "C2", year: "2012")
121
+ when "2012 NESC Handbook, Seventh Edition" then PubId.new(publisher: "NESC", number: "HBK", year: "2012")
122
+ when /^Amendment to IEEE Std 802\.11-2007 as amended by IEEE Std 802\.11k-2008/
123
+ PubId.new(publisher: "IEEE", number: "802", part: "11u", year: "2007")
124
+ when "Std 11073-10417-2009" then PubId.new(publisher: "IEEE", number: "11073", part: "10417", year: "2009")
116
125
 
117
126
  # drop all with <standard_id>0</standard_id>
118
127
  # when "IEEE Std P1671/D5, June 2006", "IEEE Std PC37.100.1/D8, Dec 2006",
@@ -380,7 +389,7 @@ module RelatonIeee
380
389
  PubId.new(publisher: "IEEE", number: $1, part: sp($2), draft: dn($3), year: $4)
381
390
 
382
391
  # publisher, number, draft, year, month
383
- when /^([A-Z\/]+)\s(\w+)\/D([\d.]+),\s(\w+)\s(\d{4})/
392
+ when /^([A-Z\/]+)\s(\w+)[\/_]D([\d.]+),\s(\w+)\s(\d{4})/
384
393
  PubId.new(publisher: $1, number: $2, draft: dn($3), year: $5, month: mn($4))
385
394
 
386
395
  # publisher, number, draft, year
@@ -445,9 +454,9 @@ module RelatonIeee
445
454
  when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}(?:\sNo\.?)?\s(\w+)/o
446
455
  PubId.new(publisher: $1, number: $2)
447
456
 
448
- # else
449
- # warn "Failed to parse normtitle #{normtitle}"
450
- # nil # normtitle
457
+ else
458
+ warn %{Use stdnumber "#{stdnumber}" for nortitle "#{normtitle}"}
459
+ PubId.new(publisher: "IEEE", number: stdnumber)
451
460
  end
452
461
  rescue ArgumentError => e
453
462
  e
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.14.1".freeze
2
+ VERSION = "1.14.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.1
4
+ version: 1.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-05 00:00:00.000000000 Z
11
+ date: 2022-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml