relaton-ieee 1.20.1 → 1.20.2
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/lib/relaton_ieee/hash_converter.rb +3 -2
- data/lib/relaton_ieee/idams_parser.rb +4 -2
- data/lib/relaton_ieee/ieee_bibliography.rb +2 -2
- data/lib/relaton_ieee/pub_id.rb +4 -1
- data/lib/relaton_ieee/rawbib_id_parser.rb +192 -173
- data/lib/relaton_ieee/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8322acea67174d16d3ce1b6ee15eed64f3bf6f84cc15042c5d41aa1ad339a8a0
|
4
|
+
data.tar.gz: 61d77da0f64037308ead04f5a89b3519d465a8a62cd56e3442134bc9ebbe4014
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7a0fd3d0c7ea17697dccfd487e1f6d05650e871307067844ab2a0ca5f8e83d4bafffb0bd8e0876034cdc566dcd6575970ac8f993f36741f9627e1625a632c32
|
7
|
+
data.tar.gz: '038d169eb81819377924a0c6cf59474c85c9208f0abc359c187285eb9eb5e1f2ab2e3c0175b3d7a867c4e26b43b32219d2aa25641f3539d6d91443bc5ec258cf'
|
@@ -22,9 +22,10 @@ module RelatonIeee
|
|
22
22
|
|
23
23
|
# @param hash [Hash]
|
24
24
|
def editorialgroup_hash_to_bib(hash)
|
25
|
-
|
25
|
+
eg = hash.dig(:ext, :editorialgroup) || hash[:editorialgroup]
|
26
|
+
return unless eg
|
26
27
|
|
27
|
-
hash[:editorialgroup] = EditorialGroup.new(**
|
28
|
+
hash[:editorialgroup] = EditorialGroup.new(**eg)
|
28
29
|
end
|
29
30
|
|
30
31
|
def ext_hash_to_bib(hash)
|
@@ -100,8 +100,10 @@ module RelatonIeee
|
|
100
100
|
# @return [Array<RelatonBib::FormattedString>]
|
101
101
|
#
|
102
102
|
def parse_abstract
|
103
|
-
@doc.volume.article.articleinfo.abstract.
|
104
|
-
|
103
|
+
@doc.volume.article.articleinfo.abstract.each_with_object([]) do |abs, acc|
|
104
|
+
next unless abs.abstract_type == "Standard"
|
105
|
+
|
106
|
+
acc << RelatonBib::FormattedString.new(content: abs.value, language: "en", script: "Latn")
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
@@ -12,9 +12,9 @@ module RelatonIeee
|
|
12
12
|
# @return [RelatonIeee::IeeeBibliographicItem]
|
13
13
|
#
|
14
14
|
def search(code) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
15
|
-
ref = code.sub(/Std\s/i, "") # .gsub(/[\s,:\/]/, "_").squeeze("_").upcase
|
15
|
+
# ref = code.sub(/Std\s/i, "") # .gsub(/[\s,:\/]/, "_").squeeze("_").upcase
|
16
16
|
index = Relaton::Index.find_or_create :ieee, url: "#{GH_URL}index-v1.zip", file: INDEX_FILE
|
17
|
-
row = index.search(
|
17
|
+
row = index.search(code).min_by { |r| r[:id] }
|
18
18
|
return unless row
|
19
19
|
|
20
20
|
resp = Faraday.get "#{GH_URL}#{row[:file]}"
|
data/lib/relaton_ieee/pub_id.rb
CHANGED
@@ -5,7 +5,7 @@ module RelatonIeee
|
|
5
5
|
attr_reader :number
|
6
6
|
|
7
7
|
# @return [String, nil]
|
8
|
-
attr_reader :publisher, :stage, :part, :status, :approval, :edition,
|
8
|
+
attr_reader :publisher, :std, :stage, :part, :status, :approval, :edition,
|
9
9
|
:draft, :rev, :corr, :amd, :redline, :year, :month
|
10
10
|
|
11
11
|
#
|
@@ -15,6 +15,7 @@ module RelatonIeee
|
|
15
15
|
# @param [<Hash>] **args
|
16
16
|
# @option args [String] :number
|
17
17
|
# @option args [String] :publisher
|
18
|
+
# @option args [Boolean] :std
|
18
19
|
# @option args [String] :stage
|
19
20
|
# @option args [String] :part
|
20
21
|
# @option args [String] :status
|
@@ -30,6 +31,7 @@ module RelatonIeee
|
|
30
31
|
#
|
31
32
|
def initialize(number:, **args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
32
33
|
@publisher = args[:publisher]
|
34
|
+
@std = args[:std]
|
33
35
|
@stage = args[:stage]
|
34
36
|
@number = number
|
35
37
|
@part = args[:part]
|
@@ -54,6 +56,7 @@ module RelatonIeee
|
|
54
56
|
#
|
55
57
|
def to_s(trademark: false) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
56
58
|
out = number
|
59
|
+
out = "Std #{out}" if std
|
57
60
|
out = "#{stage} #{out}" if stage
|
58
61
|
out = "#{approval} #{out}" if approval
|
59
62
|
out = "#{status} #{out}" if status
|
@@ -2,10 +2,10 @@ require "relaton_ieee/pub_id"
|
|
2
2
|
|
3
3
|
module RelatonIeee
|
4
4
|
module RawbibIdParser
|
5
|
-
|
6
|
-
APPROVAL = '(?:\s(Unapproved|Approved))'.freeze
|
5
|
+
STAGE = '(?<stage>DIS\d?|PSI|FCD|FDIS|CD\d?|Pub2|CDV|TS|SI)'.freeze
|
6
|
+
APPROVAL = '(?:\s(?<approval>Unapproved|Approved))'.freeze
|
7
7
|
APPROV = '(?:\s(?:Unapproved|Approved))?'.freeze
|
8
|
-
STD = "(
|
8
|
+
STD = "(?<std>\s(?i)Std.?(?-i))?".freeze
|
9
9
|
|
10
10
|
#
|
11
11
|
# Parse normtitle
|
@@ -26,7 +26,7 @@ module RelatonIeee
|
|
26
26
|
# when /^(\d+)\.(\w+)-(\d{4})\s\(Amendment/ then "IEEE #{$1}-#{$2}.#{$3}"
|
27
27
|
when "A.I.E.E. No. 15 May-1928" then PubId.new(publisher: "AIEE", number: "15", year: "1928", month: "05")
|
28
28
|
# when "AIEE Nos 72 and 73 - 1932" then "AIEE 72_73.1932"
|
29
|
-
when "IEEE Std P1073.1.3.4/D3.0" then PubId.new(publisher: "IEEE", number: "P11073", part: "00101") # "IEEE P11073-00101"
|
29
|
+
when "IEEE Std P1073.1.3.4/D3.0" then PubId.new(publisher: "IEEE", std: true, number: "P11073", part: "00101") # "IEEE Std P11073-00101"
|
30
30
|
# when "P1073.1.3.4/D3.0" then PubId.new(publisher: "IEEE", number: "P1073", part: "1-3-4", draft: "3.0") # "IEEE P1073-1-3-4/D3.0"
|
31
31
|
when "IEEE P1073.2.1.1/D08" then PubId.new(publisher: "ISO/IEEE", number: "P1073", part: "2-1-1", draft: "08") # "ISO/IEEE P1073-2-1-1/D08"
|
32
32
|
when "IEEE P802.1Qbu/03.0, July 2015" # "IEEE P802.1Qbu/D3.0.2015"
|
@@ -44,7 +44,7 @@ module RelatonIeee
|
|
44
44
|
when "AIEE No 431 (105) -1958" then PubId.new(publisher: "AIEE", number: "431", year: "1958") # "AIEE 431.1958"
|
45
45
|
when "IEEE 1076-CONC-I99O" then PubId.new(publisher: "IEEE", number: "1076", year: "199O") # "IEEE 1076.199O"
|
46
46
|
when "IEEE Std 960-1993, IEEE Std 1177-1993" # "IEEE 960/1177.1993"
|
47
|
-
PubId.new([{ publisher: "IEEE", number: "960" }, { number: "1177", year: "1993" }])
|
47
|
+
PubId.new([{ publisher: "IEEE", std: true, number: "960" }, { number: "1177", year: "1993" }])
|
48
48
|
when "IEEE P802.11ajD8.0, August 2017" # "IEEE P802-11aj/D8.0.2017"
|
49
49
|
PubId.new(publisher: "IEEE", number: "P802", part: "11aj", draft: "8.0", year: "2017")
|
50
50
|
when "IEEE P802.11ajD9.0, November 2017" # "IEEE P802-11aj/D9.0.2017"
|
@@ -98,21 +98,21 @@ module RelatonIeee
|
|
98
98
|
when "ISO/IEC/IEEE/P16085_DIS, March 2020"
|
99
99
|
PubId.new(publisher: "ISO/IEC/IEEE", stage: "DIS", number: "P16085", year: "2020", month: "03")
|
100
100
|
when "ANSI/IEEE Std: Outdoor Apparatus Bushings"
|
101
|
-
PubId.new(publisher: "ANSI/IEEE", number: "21", year: "1976", month: "11")
|
101
|
+
PubId.new(publisher: "ANSI/IEEE", std: true, number: "21", year: "1976", month: "11")
|
102
102
|
when "Unapproved Draft Std ISO/IEC FDIS 15288:2007(E) IEEE P15288/D3,"
|
103
|
-
PubId.new(publisher: "ISO/IEC/IEEE", stage: "FDIS", number: "P15288", draft: "3", year: "2007")
|
103
|
+
PubId.new(publisher: "ISO/IEC/IEEE", stage: "FDIS", std: true, number: "P15288", draft: "3", year: "2007")
|
104
104
|
when "Draft National Electrical Safety Code, January 2016"
|
105
105
|
PubId.new(publisher: "IEEE", number: "PC2", year: "2016", month: "01")
|
106
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")
|
107
107
|
when "IEEE Unapproved Draft Std P802.1AB/REVD2.2, Dec 2007" # "IEEE P802.1AB/REV/D2.2.2007"
|
108
|
-
PubId.new(publisher: "IEEE", number: "P802", part: "1AB", rev: "", draft: "2.2", year: "2007", month: "12")
|
108
|
+
PubId.new(publisher: "IEEE", std: true, number: "P802", part: "1AB", rev: "", draft: "2.2", year: "2007", month: "12")
|
109
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")
|
110
|
+
PubId.new(publisher: "ISO/IEC/IEEE", std: true, number: "802", part: "9", year: "1996")
|
111
111
|
when "ISO/IEC13210: 1994 (E) ANSI/IEEE Std 1003.3-1991"
|
112
112
|
PubId.new(publisher: "ISO/IEC/IEEE", number: "13210", year: "1994")
|
113
113
|
when "J-STD-016-1995" then PubId.new(publisher: "IEEE", number: "016", year: "1995")
|
114
114
|
when "Std 802.1ak-2007 (Amendment to IEEE Std 802.1QTM-2005)"
|
115
|
-
PubId.new(publisher: "IEEE", number: "802", part: "1ak", year: "2007")
|
115
|
+
PubId.new(publisher: "IEEE", std: true, number: "802", part: "1ak", year: "2007")
|
116
116
|
when "IS0/IEC/IEEE 8802-11:2012/Amd.5:2015(E) (Adoption of IEEE Std 802.11af-2014)"
|
117
117
|
PubId.new(publisher: "ISO/IEC/IEEE", number: "802", part: "11", year: "2012", amd: "5", year_amendment: "2015")
|
118
118
|
when "National Electrical Safety Code, C2-2012 - Redline"
|
@@ -120,8 +120,8 @@ module RelatonIeee
|
|
120
120
|
when "National Electrical Safety Code, C2-2012" then PubId.new(publisher: "IEEE", number: "C2", year: "2012")
|
121
121
|
when "2012 NESC Handbook, Seventh Edition" then PubId.new(publisher: "NESC", number: "HBK", year: "2012")
|
122
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")
|
123
|
+
PubId.new(publisher: "IEEE", std: true, number: "802", part: "11u", year: "2007")
|
124
|
+
when "Std 11073-10417-2009" then PubId.new(publisher: "IEEE", std: true, number: "11073", part: "10417", year: "2009")
|
125
125
|
when "Nuclear EQ Sourcebook and Supplement" then PubId.new publisher: "IEEE", number: "7438946"
|
126
126
|
|
127
127
|
# drop all with <standard_id>0</standard_id>
|
@@ -144,24 +144,26 @@ module RelatonIeee
|
|
144
144
|
PubId.new([{ publisher: $1, number: $2, part: sp($3) }, { number: $4, part: sp($5), draft: dn($6), year: $8, month: mn($7) }])
|
145
145
|
|
146
146
|
# publisher, approval, number, part, corrigendum, draft, year
|
147
|
-
when /^([A-Z\/]+)#{APPROVAL}(?:\sDraft)?\sStd\s(
|
148
|
-
|
147
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROVAL}(?:\sDraft)?\sStd\s(?<number>\w+)\.(?<part>\d+)-\d{4}[^\/]*\/Cor\s?(?<corr>\d)\/(?<draft>D[\d\.]+),\s(?:\w+\s)?(?<year>\d{4})/o
|
148
|
+
create_pubid(Regexp.last_match)
|
149
149
|
|
150
150
|
# publisher, number, part, corrigendum, draft, year, month
|
151
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
152
|
-
|
151
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\.(?<part>\w+)-\d{4}\/Cor\s?(?<corr>\d(?:-\d+x)?)[\/_]D(?<draft>[\d\.]+),\s?(?<month>\w+)\s(?<year>\d{4})/o
|
152
|
+
create_pubid(Regexp.last_match)
|
153
153
|
|
154
154
|
# publidsher1, number1, year1 publisher2, number2, draft, year2
|
155
155
|
when /^([A-Z\/]+)\s(\w+)-(\d{4})\/([A-Z]+)\s([[:alnum:]]+)_D([\w.]+),\s(\d{4})/
|
156
156
|
PubId.new([{ publisher: $1, number: $2, year: $3 }, { publisher: $4, number: $5, draft: dn($6), year: $7 }])
|
157
157
|
|
158
|
-
when /^([A-Z\/]+)\s
|
159
|
-
|
158
|
+
when /^(?<publisher>[A-Z\/]+)\s#{STAGE}\s(?<number>\w+)[.-](?<part>[[:alnum:].-]+)[\s\/_]ED(?<edition>[\w.]+),\s(?<month>\w+)\s(?<year>\d{4})/o
|
159
|
+
create_pubid(Regexp.last_match)
|
160
160
|
|
161
161
|
# publidsher1, number1, publisher2, number2, draft, year
|
162
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
163
|
-
/^([A-Z\/]+)\s(
|
164
|
-
|
162
|
+
when /^(?<publisher1>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number1>\w+)\/(?<publisher2>[A-Z]+)\s(?<number2>[[:alnum:]]+)_D(?<draft>[\d\.]+),\s\w+\s(?<year>\d{4})/o,
|
163
|
+
/^(?<publisher1>[A-Z\/]+)\s(?<number1>\w+)\sand\s(?<publisher2>[A-Z]+)(?:\sGuideline)?\s(?<number2>[[:alnum:]]+)\/D(?<draft>[\d\.]+),\s\w+\s(?<year>\d{4})/o
|
164
|
+
nc = Regexp.last_match.named_captures
|
165
|
+
PubId.new([{ publisher: nc["publisher1"], std: !!nc["std"], number: nc["number1"] },
|
166
|
+
{ publisher: nc["publisher2"], number: nc["number2"], draft: dn(nc["draft"]), year: nc["year"] }])
|
165
167
|
|
166
168
|
# publidsher1, number1, part, publisher2, number2, year
|
167
169
|
when /^([A-Z\/]+)\s(\w+)\.(\d+)_(\w+)\s(\w+),\s(\d{4})/ # "#{$1} #{$2}-#{$3}/#{$4} #{$5}.#{$6}"
|
@@ -176,72 +178,70 @@ module RelatonIeee
|
|
176
178
|
PubId.new([{ publisher: $1, number: $2, part: $3 }, { number: $4, part: $5, year: $6 }])
|
177
179
|
|
178
180
|
# publisher, number, part, corrigendum, draft, year
|
179
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
180
|
-
/^([A-Z\/]+)\s(
|
181
|
-
/^([A-Z\/]+)\s(
|
182
|
-
|
181
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>[\d-]+)\/Cor\s?(?<corr>\d)[\/_]D(?<draft>[\d\.]+),\s(?:\w+\s)?(?<year>\d{4})/o,
|
182
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)[.-](?<part>\d+)-\d{4}\/Cor\s?(?<corr>\d)(?:-|,\s|\/)D(?<draft>[\d.]+),?\s\w+\s(?<year>\d{4})/,
|
183
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\.(?<part>[[:alnum:].]+)[-_]Cor[\s-]?(?<corr>\d)\/D(?<draft>[\d.]+),?\s\w+\s(?<year>\d{4})/
|
184
|
+
create_pubid(Regexp.last_match)
|
183
185
|
when /^([A-Z\/]+)\s(\w+)\.(\d+)-\d{4}\/Cor(\d)-(\d{4})\/D([\d.]+)/ # "#{$1} #{$2}-#{$3}/Cor#{$4}/D#{$6}.#{$5}"
|
184
186
|
PubId.new(publisher: $1, number: $2, part: $3, corr: $4, draft: dn($6), year: $5)
|
185
187
|
|
186
188
|
# publisher, status, number, part, draft, year, month
|
187
|
-
when /^([A-Z\/]+)(
|
188
|
-
|
189
|
+
when /^(?<publisher>[A-Z\/]+)(?<status>\sActive)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>[[:alnum:]\.]+)\s?[\/_]D(?<draft>[\w\.]+),?\s(?<month>\w+)(?:\s\d{1,2},)?\s?(?<year>\d{2,4})/o
|
190
|
+
create_pubid(Regexp.last_match)
|
189
191
|
|
190
192
|
# publisher, approval, number, part, draft, year, month
|
191
|
-
when /^([A-Z\/]+)(?:\sActive)?#{APPROVAL}(?:\sDraft)?#{STD}\s(
|
192
|
-
|
193
|
-
|
194
|
-
PubId.new(publisher: $1, number: $2, part: sp($3), draft: dn($4), year: $6, month: mn($5), approval: $7)
|
193
|
+
when /^(?<publisher>[A-Z\/]+)(?:\sActive)?#{APPROVAL}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>[[:alnum:]\.]+)\s?[\/_]D(?<draft>[\w\.-]+),?\s(?<month>\w+)(?:\s\d{1,2},)?\s?(?<year>\d{2,4})/o,
|
194
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\.(?<part>[\w.]+)\/D(?<draft>[\w.]+),?\s(?<month>\w+)[\s_](?<year>\d{4})(?:\s-\s\(|\s\(|_)#{APPROVAL}/
|
195
|
+
create_pubid(Regexp.last_match)
|
195
196
|
|
196
197
|
# publisher, approval, number, draft, year, month
|
197
|
-
when /^([A-Z\/]+)\s(
|
198
|
-
|
198
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\/D(?<draft>[\w.]+),\s(?<month>\w+)\s(?<year>\d{4})\s-\s\(?#{APPROVAL}/
|
199
|
+
create_pubid(Regexp.last_match)
|
199
200
|
|
200
201
|
# publisher, approval, number, part, draft, year
|
201
|
-
when /^([A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s(
|
202
|
-
|
203
|
-
|
204
|
-
PubId.new(publisher: $1, number: $2, part: sp($3), draft: dn($4), year: $5, approval: $6)
|
202
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>[\w.]+)\s?[\/_\s]D(?<draft>[\w\.]+),?\s\w+\s?(?<year>\d{4})/o,
|
203
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\.(?<part>[\w.]+)\/D(?<draft>[\d.]+),?\s\w+[\s_](?<year>\d{4})(?:\s-\s\(|_|\s\()?#{APPROVAL}/o
|
204
|
+
create_pubid(Regexp.last_match)
|
205
205
|
|
206
206
|
# publisher, stage, number, part, edition, year, month
|
207
|
-
when /^([A-Z\/]+)\s(
|
208
|
-
|
207
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)[.-](?<part>[[:alnum:].-]+)[\/_]#{STAGE}\s(?<edition>\w+)\sedition,\s(?<month>\w+)\s(?<year>\d{4})/o
|
208
|
+
create_pubid(Regexp.last_match)
|
209
209
|
|
210
210
|
# number, part, corrigendum, draft, year
|
211
|
-
when /^(
|
212
|
-
|
211
|
+
when /^(?<number>\w+)\.(?<part>[\w.]+)-\d{4}[_\/]Cor\s?(?<corr>\d)\/D(?<draft>[\w.]+),?\s\w+\s(?:\d{2},\s)?(?<year>\d{4})/
|
212
|
+
create_pubid(Regexp.last_match)
|
213
213
|
|
214
214
|
# publisher, approval, number, part, draft
|
215
|
-
when /^([A-Z\/]+)\s(
|
216
|
-
|
215
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\.(?<part>\d+)\/D(?<draft>[\d.]+)\s\([^)]+\)\s-#{APPROVAL}/o
|
216
|
+
create_pubid(Regexp.last_match)
|
217
217
|
|
218
218
|
# publisher, number, part1, rev, draft, part2
|
219
|
-
when /^([A-Z\/]+)#{STD}\s(
|
220
|
-
|
219
|
+
when /^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)\.(?<part>[\d.]+)REV(?<rev>[a-z]+)_D(?<draft>[\w.]+)\sPart\s(?<part2>\d)/o
|
220
|
+
create_pubid(Regexp.last_match)
|
221
221
|
|
222
222
|
# publisher, number, part, draft, year, month
|
223
|
-
when /^([A-Z\/]+)#{STD}\s(
|
224
|
-
|
223
|
+
when /^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)[.-](?<part>[[:alnum:].]+)[\/\s_]D(?<draft>[\d.]+)(?:,?\s|_)(?<month>[[:alpha:]]+)[\s_]?(?<year>\d{4})/o
|
224
|
+
create_pubid(Regexp.last_match)
|
225
225
|
|
226
226
|
# publisher, stage, number, part, draft, year
|
227
|
-
when /^([\w\/]+)\s(
|
228
|
-
|
227
|
+
when /^(?<publisher>[\w\/]+)\s(?<stage>#{STAGE})\s(?<number>\w+)-(?<part>[[:alnum:]]+)[\/_\s]D(?<draft>[\d.]+),\s\w+\s(?<year>\d{4})/o
|
228
|
+
create_pubid(Regexp.last_match)
|
229
229
|
|
230
230
|
# publisher, number, part, rev, draft, year, month
|
231
|
-
when /^([A-Z\/]+)\s(
|
232
|
-
|
231
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\.(?<part>[\w.]+)-Rev\/D(?<draft>[\w.]+),\s(?<month>\w+)\s(?<year>\d{4})/
|
232
|
+
create_pubid(Regexp.last_match)
|
233
233
|
|
234
234
|
# publisher, number, part, rev, draft, year
|
235
|
-
when /^([A-Z\/]+)\s(
|
236
|
-
|
235
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\.(?<part>[\d.]+)Rev(?<rev>\w+)-D(?<draft>[\w.]+),\s\w+\s(?<year>\d{4})/
|
236
|
+
create_pubid(Regexp.last_match)
|
237
237
|
|
238
238
|
# publisher, stage, number, part, edition, year
|
239
|
-
when /^([A-Z\/]+)\s(
|
240
|
-
|
239
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<stage>#{STAGE})\s(?<number>\w+)[.-](?<part>[[:alnum:].-]+)[\/\s_]ED(?<edition>[\d.]+),\s(?<year>\d{4})/o
|
240
|
+
create_pubid(Regexp.last_match)
|
241
241
|
|
242
242
|
# publisher, stage, number, draft, year, month
|
243
|
-
when /^([A-Z\/]+)\s(
|
244
|
-
|
243
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\/(?<stage>#{STAGE})[\/_]D(?<draft>[\w.]+),\s(?<month>\w+)\s(?<year>\d{4})/o
|
244
|
+
create_pubid(Regexp.last_match)
|
245
245
|
|
246
246
|
# number, part, draft, year, month
|
247
247
|
when /(\w+)[.-]([[:alnum:].]+)[\/\s_]D([\d.]+)(?:,?\s|_)([[:alpha:]]+)[\s_]?(\d{4})/
|
@@ -252,119 +252,111 @@ module RelatonIeee
|
|
252
252
|
PubId.new(publisher: "IEEE", number: $1, corr: $2, draft: dn($3), month: mn($4), year: $5)
|
253
253
|
|
254
254
|
# publisher, number, corrigendum, draft, year
|
255
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?\sStd\s(
|
256
|
-
|
255
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?\sStd\s(?<number>\w+)(?:-\d{4})?[\/_]Cor\s?(?<corr>\d)\/D(?<draft>[\d\.]+),\s\w+\s(?<year>\d{4})/o
|
256
|
+
create_pubid(Regexp.last_match)
|
257
257
|
|
258
258
|
# publisher, number, part, rev, corrigendum, draft
|
259
259
|
when /^([A-Z\/]+)\s(\w+)\.(\w+)-\d{4}-Rev\/Cor(\d)\/D([\d.]+)/
|
260
260
|
PubId.new(publisher: $1, number: $2, part: $3, rev: "", corr: $4, draft: dn($5))
|
261
261
|
|
262
262
|
# publisher, number, part, corrigendum, draft
|
263
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
264
|
-
/^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
265
|
-
|
263
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\.(?<part>[\w.]+)\/[Cc]or\s?(?<corr>\d)\/D(?<draft>[\w\.]+)/o,
|
264
|
+
/^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\.(?<part>\w+)-\d{4}\/Cor\s?(?<corr>\d)[\/_]D(?<draft>[\d\.]+)/o
|
265
|
+
create_pubid(Regexp.last_match)
|
266
266
|
|
267
267
|
# publisher, number, part, corrigendum, year
|
268
|
-
when /^([A-Z\/]+)#{STD}\s(
|
269
|
-
|
268
|
+
when /^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)[.-](?<part>[\w.]+)[:-]\d{4}[\/-]Cor[\s.]?(?<corr>\d)[:-](?<year>\d{4})/o
|
269
|
+
create_pubid(Regexp.last_match)
|
270
270
|
|
271
271
|
# publisher, number, part, draft, year
|
272
|
-
when /^([
|
273
|
-
/^([A-Z\/]+)#{STD}\s(
|
274
|
-
/^([\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s(
|
275
|
-
|
272
|
+
when /^(?<publisher>[A-Z\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>[[:alnum:]\.]+)(?:\s?\/\s?|_|,\s|-)D(?<draft>[\w\.]+)\s?,?\s\w+(?:\s\d{1,2},)?\s?(?<year>\d{2,4})/o,
|
273
|
+
/^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)[.-](?<part>[\w.-]+)[\/\s]D(?<draft>[\w.]*)(?:-|,\s?\w+\s|\s\w+:|,\s)(?<year>\d{4})/o,
|
274
|
+
/^(?<publisher>[\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>[[:alnum:]\.]+)\sDraft\s(?<draft>[\w\.]+),\s\w+\s(?<year>\d{4})/o
|
275
|
+
create_pubid(Regexp.last_match)
|
276
276
|
|
277
277
|
# publisher, approval, number, draft, year
|
278
|
-
when /^([A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s([[:alnum:]]+)\s?[\/_]\s?D([\w\.]+),?\s\w+\s(
|
279
|
-
|
280
|
-
|
281
|
-
PubId.new(publisher: $1, number: $2, draft: dn($3), year: $4, approval: $5)
|
278
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s(?<number>[[:alnum:]]+)\s?[\/_]\s?D(?<draft>[\w\.]+),?\s\w+\s(?<year>\d{2,4})/o,
|
279
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\/D(?<draft>[\d.]+),\s\w+[\s_](?<year>\d{4})(?:\s-\s\(?|_)?#{APPROVAL}/o
|
280
|
+
create_pubid(Regexp.last_match)
|
282
281
|
|
283
282
|
# publisher, number, part, rev, draft
|
284
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
285
|
-
|
286
|
-
|
287
|
-
PubId.new(publisher: $1, number: $2, part: sp($3), rev: "", draft: dn($4))
|
283
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\.(?<part>[\w.]+)[-\s\/]?REV-?(?<rev>\w+)\/D(?<draft>[\d.]+)/o,
|
284
|
+
/^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\.(?<part>[\w.]+)-REV\/D(?<draft>[\d.]+)/o
|
285
|
+
create_pubid(Regexp.last_match)
|
288
286
|
|
289
287
|
# publisher, number, part, rev, year
|
290
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?\sStd\s(
|
291
|
-
|
288
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?\sStd\s(?<number>\w+)\.(?<part>\d+)\/rev(?<rev>\d+),\s\w+\s(?<year>\d+)/o
|
289
|
+
create_pubid(Regexp.last_match)
|
292
290
|
|
293
291
|
# publisher, stage, number, draft, year
|
294
|
-
when /^([\w\/]+)\s
|
295
|
-
|
292
|
+
when /^(?<publisher>[\w\/]+)\s#{STAGE}\s(?<number>[[:alnum:]]+)[\/_]D(?<draft>[\w.]+),(?:\s\w+)?\s(?<year>\d{4})/o
|
293
|
+
create_pubid(Regexp.last_match)
|
296
294
|
|
297
295
|
# publisher, stage, number, part, year, month
|
298
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
299
|
-
|
300
|
-
|
301
|
-
PubId.new(publisher: $1, number: $3, part: sp($4), stage: $2, year: $6, month: mn($5))
|
296
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>[[:alnum:].-]+)(?:[\/_-]|,\s)#{STAGE},?\s(?<month>\w+)\s(?<year>\d{4})/o,
|
297
|
+
/^(?<publisher>[A-Z\/]+)\s(?<stage>#{STAGE})\s(?<number>\w+)[.-](?<part>\w+),\s(?<month>\w+)\s(?<year>\d{4})/o
|
298
|
+
create_pubid(Regexp.last_match)
|
302
299
|
|
303
300
|
# publisher, number, part, edition, year, month
|
304
|
-
when /^([A-Z\/]+)\s(
|
305
|
-
|
301
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)[.-](?<part>[\w.-]+)[\/\s]ED(?<edition>[\d+]),\s(?<month>\w+)\s(?<year>\d{4})/
|
302
|
+
create_pubid(Regexp.last_match)
|
306
303
|
|
307
304
|
# publisher, stage, number, part, year
|
308
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
309
|
-
/^([A-Z\/]+)\s(
|
310
|
-
/^([A-Z\/]+)\s(
|
311
|
-
|
312
|
-
|
313
|
-
PubId.new(publisher: $1, number: $3, part: sp($4), stage: $2, year: $5)
|
305
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>\d+)[\/_-]#{STAGE},?\s\w+\s(?<year>\d{4})/o,
|
306
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)-(?<part>\d+)[\/-]#{STAGE}(?:_|,\s|-)\w+\s?(?<year>\d{4})/o,
|
307
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)[.-](?<part>\d+)[\/-_]#{STAGE}[\s-](?<year>\d{4})/o,
|
308
|
+
/^(?<publisher>[A-Z\/]+)\s(?<stage>#{STAGE})\s(?<number>\w+)-(?<part>[\w-]+),\s(?<year>\d{4})/o
|
309
|
+
create_pubid(Regexp.last_match)
|
314
310
|
|
315
311
|
# publisher, stage, number, year, month
|
316
|
-
when /^([A-Z\/]+)\s
|
317
|
-
|
318
|
-
|
319
|
-
PubId.new(publisher: $1, number: $2, stage: $3, year: $5, month: mn($4))
|
312
|
+
when /^(?<publisher>[A-Z\/]+)\s#{STAGE}\s(?<number>\w+)(?:\s\g<stage>)?,\s(?<month>\w+)\s(?<year>\d{4})/o,
|
313
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>[[:alnum:]]+)(?:\s|_|\/\s?)?#{STAGE},?\s(?<month>\w+)\s(?<year>\d{4})/o
|
314
|
+
create_pubid(Regexp.last_match)
|
320
315
|
|
321
316
|
# publisher, stage, number, part, draft
|
322
|
-
when /^([A-Z\/]+)[.-]([[:alnum:].-]+)[\/_]D([[:alnum:].]+)[\/_]
|
323
|
-
|
324
|
-
|
317
|
+
when /^(?<publisher>[A-Z\/]+)[.-](?<part>[[:alnum:].-]+)[\/_]D(?<draft>[[:alnum:].]+)[\/_]#{STAGE}/o,
|
318
|
+
/^(?<number>\w+)[.-](?<part>[[:alnum:].]+)[\/\s_]D(?<draft>[\d.]+)_(?<stage>#{STAGE})/o
|
319
|
+
create_pubid(Regexp.last_match)
|
325
320
|
|
326
321
|
# publisher, stage, number, year
|
327
|
-
when /^([A-Z\/]+)\s
|
328
|
-
|
329
|
-
|
330
|
-
PubId.new(publisher: $1, number: $2, stage: $3, year: $4)
|
322
|
+
when /^(?<publisher>[A-Z\/]+)\s#{STAGE}\s(?<number>\w+)(?:,\s\w+\s|:)(?<year>\d{4})/o,
|
323
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)(?:\/|,\s)(?<stage>#{STAGE})-(?<year>\d{4})/o
|
324
|
+
create_pubid(Regexp.last_match)
|
331
325
|
|
332
326
|
# publisher, stage, number, part
|
333
|
-
when /^([A-Z\/]+)\s(
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
when /^([A-Z\/]+)\s(#{STAGES})\s(\w+)[.-]([[:alnum:].-]+)/o
|
338
|
-
PubId.new(publisher: $1, number: $3, part: sp($4), stage: $2)
|
327
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)-(?<part>[\w-]+)[\s-]#{STAGE}/o,
|
328
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)-#{STAGE}-(?<part>\w+)/o,
|
329
|
+
/^(?<publisher>[A-Z\/]+)\s#{STAGE}\s(?<number>\w+)[.-](?<part>[[:alnum:].-]+)/o
|
330
|
+
create_pubid(Regexp.last_match)
|
339
331
|
|
340
332
|
# publisher, number, corrigendum, year
|
341
|
-
when /^([A-Z\/]+)#{STD}\s(
|
342
|
-
|
333
|
+
when /^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)-\d{4}\/Cor\s?(?<corr>\d)-(?<year>\d{4})/o
|
334
|
+
create_pubid(Regexp.last_match)
|
343
335
|
|
344
336
|
# publisher, number, rev, draft
|
345
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
346
|
-
|
337
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)-REV\/D(?<draft>[\d.]+)/o
|
338
|
+
create_pubid(Regexp.last_match)
|
347
339
|
|
348
340
|
# publisher, number, part, year, month
|
349
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
350
|
-
|
351
|
-
|
341
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)-(?<part>[\w-]+),\s(?<month>\w+)\s?(?<year>\d{4})/o,
|
342
|
+
/^(?<publisher>[A-Z\/]+)\sStd\s(?<number>\w+)\.(?<part>\w+)-\d{4}\/INT,?\s(?<month>\w+)\.?\s(?<year>\d{4})/
|
343
|
+
create_pubid(Regexp.last_match)
|
352
344
|
|
353
345
|
# publisher, number, part, amendment, year
|
354
|
-
when /^([A-Z\/]+)#{STD}\s(
|
355
|
-
|
346
|
+
when /^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)-(?<part>\w+)[:-](?<year>\d{4})\/Amd(?:\s|.\s?)?(?<amd>\d)/o
|
347
|
+
create_pubid(Regexp.last_match)
|
356
348
|
|
357
349
|
# publisher, number, part, year, redline
|
358
|
-
when /^([A-Z\/]+)#{STD}\s(
|
359
|
-
/^([A-Z\/]+)#{STD}\s(
|
360
|
-
|
350
|
+
when /^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)[.-](?<part>[\w.]+)[:-](?<year>\d{4}).*?\s-\s(?<redline>Redline)/o,
|
351
|
+
/^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)[.-](?<part>[\w.-]+):(?<year>\d{4}).*?\s-\s(?<redline>Redline)/o
|
352
|
+
create_pubid(Regexp.last_match)
|
361
353
|
|
362
354
|
# publisher, number, part, year
|
363
|
-
when /^([A-Z\/]+)\s(
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
355
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)-(?<part>\d{1,3}),\s\w+\s(?<year>\d{4})/,
|
356
|
+
/^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)[.-](?!(?:19|20)\d{2}\D)(?<part>[\w.]+)(?:,\s\w+\s|-|:|,\s|\.|:)(?<year>\d{4})/o,
|
357
|
+
/^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)[.-](?!(?:19|20)\d{2}\D)(?<part>[\w.-]+)(?:,\s\w+\s|:|,\s|\.|:)(?<year>\d{4})/o,
|
358
|
+
/^(?<publisher>[A-Z\/]+)#{STD}\sNo(?:\.?\s|\.)(?<number>\w+)\.(?<part>\d+)\s?-(?:\w+\s)?(?<year>\d{4})/o
|
359
|
+
create_pubid(Regexp.last_match)
|
368
360
|
|
369
361
|
# publisher, number, edition, year
|
370
362
|
when /^([A-Z\/]+)\s(\w+)\s(\w+)\sEdition,\s\w+\s(\d+)/,
|
@@ -372,76 +364,74 @@ module RelatonIeee
|
|
372
364
|
PubId.new(publisher: $1, number: $2, edition: en($3), year: $4)
|
373
365
|
|
374
366
|
# publisher, number, part, conformance, draft
|
375
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
376
|
-
|
367
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\.(?<part>[[:alnum:].]+)[\/-]Conformance(?<conformance>\d+)[\/_]D(?<draft>[\w\.]+)/o
|
368
|
+
create_pubid(Regexp.last_match)
|
377
369
|
|
378
370
|
# publisher, number, part, conformance, year
|
379
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
380
|
-
|
371
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\.(?<part>[[:alnum:].]+)\s?\/\s?Conformance(?<conformance>\d+)-(?<year>\d{4})/o
|
372
|
+
create_pubid(Regexp.last_match)
|
381
373
|
|
382
374
|
# publisher, number, part, draft
|
383
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
384
|
-
/^([A-Z\/]+)\s(
|
385
|
-
/^([A-Z\/]+)\s(
|
386
|
-
|
375
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\.(?<part>[[:alnum:].]+)[^\/]*\/D(?<draft>[[:alnum:]\.]+)/o,
|
376
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)[.-](?<part>[[:alnum:]-]+)[\s_]D(?<draft>[\d.]+)/,
|
377
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)-(?<part>\w+)\/D(?<draft>[\w.]+)/
|
378
|
+
create_pubid(Regexp.last_match)
|
387
379
|
|
388
380
|
# number, part, draft, year
|
389
|
-
when /^(
|
390
|
-
|
381
|
+
when /^(?<number>\w+)[.-](?<part>[[:alnum:].-]+)(?:\/|,\s|_)D(?<draft>[\d.]+),?\s(?:\w+,?\s)?(?<year>\d{4})/
|
382
|
+
create_pubid(Regexp.last_match)
|
391
383
|
|
392
384
|
# publisher, number, draft, year, month
|
393
|
-
when /^([A-Z\/]+)\s(
|
394
|
-
|
385
|
+
when /^(?<publisher>[A-Z\/]+)\s(?<number>\w+)[\/_]D(?<draft>[\d.]+),\s(?<month>\w+)\s(?<year>\d{4})/
|
386
|
+
create_pubid(Regexp.last_match)
|
395
387
|
|
396
388
|
# publisher, number, draft, year
|
397
|
-
when /^([\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s([[:alnum:]]+)\s?[\/_]\s?D([\w\.-]+),?\s(?:\w+\s)?(
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
PubId.new(publisher: $1, number: $2, draft: dn($4), year: $3)
|
389
|
+
when /^(?<publisher>[\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s(?<number>[[:alnum:]]+)\s?[\/_]\s?D(?<draft>[\w\.-]+),?\s(?:\w+\s)?(?<year>\d{2,4})/o,
|
390
|
+
/^(?<publisher>[\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s(?<number>[[:alnum:]]+)\/?D?(?<draft>[\d\.]+),?\s\w+\s(?<year>\d{4})/o,
|
391
|
+
/^(?<publisher>[A-Z\/]+)\s(?<number>\w+)\/Draft\s(?<draft>[\d.]+),\s\w+\s(?<year>\d{4})/,
|
392
|
+
/^(?<publisher>[A-Z\/]+)\sStd\s(?<number>\w+)-(?<year>\d{4})\sDraft\s(?<draft>[\d.]+)/
|
393
|
+
create_pubid(Regexp.last_match)
|
403
394
|
|
404
395
|
# publisher, approval, number, draft
|
405
|
-
when /^([A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s([[:alnum:]]+)[\/_]D([\w.]+)/o
|
406
|
-
|
396
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s(?<number>[[:alnum:]]+)[\/_]D(?<draft>[\w.]+)/o
|
397
|
+
create_pubid(Regexp.last_match)
|
407
398
|
|
408
399
|
# number, draft, year
|
409
|
-
when /^(
|
410
|
-
|
400
|
+
when /^(?<number>\w+)\/D(?<draft>[\w.+]+),?\s\w+,?\s(?<year>\d{4})/
|
401
|
+
create_pubid(Regexp.last_match)
|
411
402
|
|
412
403
|
# number, rev, draft
|
413
|
-
when /^(
|
414
|
-
|
404
|
+
when /^(?<number>\w+)-REV\/D(?<draft>[\d.]+)/o
|
405
|
+
create_pubid(Regexp.last_match)
|
415
406
|
|
416
407
|
# publisher, number, draft
|
417
|
-
when /^([\w\/]+)#{APPROV}(?:\sDraft)?#{STD}\s([[:alnum:]]+)[\/_]D([\w.]+)/o
|
418
|
-
|
408
|
+
when /^(?<publisher>[\w\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>[[:alnum:]]+)[\/_]D(?<draft>[\w.]+)/o
|
409
|
+
create_pubid(Regexp.last_match)
|
419
410
|
|
420
411
|
# publisher, number, year, month
|
421
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
422
|
-
|
412
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)(?:-\d{4})?,\s(?<month>\w+)\s(?<year>\d{4})/o
|
413
|
+
create_pubid(Regexp.last_match)
|
423
414
|
|
424
415
|
# publisher, number, year, redline
|
425
|
-
when /^([A-Z\/]+)#{STD}\s(
|
426
|
-
|
416
|
+
when /^(?<publisher>[A-Z\/]+)#{STD}\s(?<number>\w+)[:-](?<year>\d{4}).*?\s-\s(?<redline>Redline)/o
|
417
|
+
create_pubid(Regexp.last_match)
|
427
418
|
|
428
419
|
# publisher, number, year
|
429
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
430
|
-
/^(
|
431
|
-
/^([\w\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
432
|
-
/^(
|
433
|
-
/^([A-Z\/]+)\sStd\s(
|
434
|
-
|
435
|
-
|
436
|
-
PubId.new(publisher: "ANSI/IEEE", number: $1, year: $2)
|
420
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)(?:-|:|,\s(?:\w+\s)?)(?<year>\d{2,4})/o,
|
421
|
+
/^(?<publisher>\w+)#{APPROV}(?:\sDraft)?\sStd\s(?<number>\w+)\/\w+\s(?<year>\d{4})/o,
|
422
|
+
/^(?<publisher>[\w\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)\/FCD-\w+(?<year>\d{4})/o,
|
423
|
+
/^(?<publisher>\w+)#{STD}\sNo(?:\.?\s|\.)(?<number>\w+)\s?(?:-|,\s)(?:\w+\s)?(?<year>\d{4})/o,
|
424
|
+
/^(?<publisher>[A-Z\/]+)\sStd\s(?<number>\w+)\/INT-(?<year>\d{4})/,
|
425
|
+
/^(?<publisher>ANSI\/\sIEEE)#{STD}\s(?<number>\w+)-(?<year>\d{4})/o
|
426
|
+
create_pubid(Regexp.last_match)
|
437
427
|
|
438
428
|
# publisher, number, part
|
439
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(
|
440
|
-
|
429
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(?<number>\w+)[.-](?<part>[\d.]+)/o
|
430
|
+
create_pubid(Regexp.last_match)
|
441
431
|
|
442
432
|
# number, part, draft
|
443
|
-
when /^(
|
444
|
-
|
433
|
+
when /^(?<number>\w+)\.(?<part>[\w.]+)\/D(?<draft>[\w.]+)/
|
434
|
+
create_pubid(Regexp.last_match)
|
445
435
|
|
446
436
|
# number, part, year
|
447
437
|
when /^(\d{2})\sIRE\s(\w+)[\s.](\w+)/ # "IRE #{$2}-#{$3}.#{yn $1}"
|
@@ -452,17 +442,44 @@ module RelatonIeee
|
|
452
442
|
when /^(\w+)-(\d{4})\D/ then PubId.new(publisher: "IEEE", number: $1, year: $2)
|
453
443
|
|
454
444
|
# publisher, number
|
455
|
-
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}(?:\sNo\.?)?\s(
|
456
|
-
|
445
|
+
when /^(?<publisher>[A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}(?:\sNo\.?)?\s(?<number>\w+)/o
|
446
|
+
create_pubid(Regexp.last_match)
|
457
447
|
|
458
448
|
else
|
459
449
|
Util.warn %{Use stdnumber "#{stdnumber}" for normtitle "#{normtitle}"}
|
460
|
-
PubId.new(publisher: "IEEE", number: stdnumber)
|
450
|
+
PubId.new(publisher: "IEEE", srd: true, number: stdnumber)
|
461
451
|
end
|
462
452
|
rescue ArgumentError => e
|
463
453
|
e
|
464
454
|
end
|
465
455
|
|
456
|
+
def create_pubid(regex_match)
|
457
|
+
args = regex_match.named_captures
|
458
|
+
PubId.new(
|
459
|
+
publisher: args["publisher"] || "IEEE",
|
460
|
+
std: !!args["std"],
|
461
|
+
number: args["number"],
|
462
|
+
part: part(args),
|
463
|
+
draft: dn(args["draft"]),
|
464
|
+
year: yn(args["year"]),
|
465
|
+
month: mn(args["month"]),
|
466
|
+
stage: args["stage"],
|
467
|
+
rev: args["rev"],
|
468
|
+
corr: args["corr"],
|
469
|
+
edition: en(args["edition"]),
|
470
|
+
amd: args["amd"],
|
471
|
+
redline: args["redline"],
|
472
|
+
approval: args["approval"],
|
473
|
+
status: args["status"]
|
474
|
+
)
|
475
|
+
end
|
476
|
+
|
477
|
+
def part(args)
|
478
|
+
return unless args.key?("part")
|
479
|
+
|
480
|
+
[args["part"], args["conformance"]].compact.join("-")
|
481
|
+
end
|
482
|
+
|
466
483
|
# replace subpart's delimiter
|
467
484
|
#
|
468
485
|
# @param parts [Strong]
|
@@ -480,7 +497,7 @@ module RelatonIeee
|
|
480
497
|
# @return [String, nil] nil if string's length isn't 2 or 4
|
481
498
|
#
|
482
499
|
def yn(year)
|
483
|
-
return year if year.size == 4
|
500
|
+
return year if year.nil? || year.size == 4
|
484
501
|
|
485
502
|
y = Date.today.year.to_s[2..4].to_i + 1
|
486
503
|
case year.to_i
|
@@ -497,6 +514,8 @@ module RelatonIeee
|
|
497
514
|
# @return [String] 2 digits month number
|
498
515
|
#
|
499
516
|
def mn(month)
|
517
|
+
return if month.nil?
|
518
|
+
|
500
519
|
n = Date::ABBR_MONTHNAMES.index(month) || Date::MONTHNAMES.index(month)
|
501
520
|
return month unless n
|
502
521
|
|
@@ -519,7 +538,7 @@ module RelatonIeee
|
|
519
538
|
end
|
520
539
|
|
521
540
|
def dn(draftnum)
|
522
|
-
draftnum.sub(/^\./, "").gsub
|
541
|
+
draftnum && draftnum.sub(/^\./, "").gsub("-", ".")
|
523
542
|
end
|
524
543
|
|
525
544
|
extend RawbibIdParser
|
data/lib/relaton_ieee/version.rb
CHANGED
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.20.
|
4
|
+
version: 1.20.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|