relaton-ieee 1.9.1 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/README.adoc +10 -0
- data/grammars/basicdoc.rng +26 -7
- data/grammars/biblio.rng +2 -2
- data/grammars/isodoc.rng +617 -89
- data/grammars/reqt.rng +34 -5
- data/lib/relaton_ieee/bibxml_parser.rb +23 -0
- data/lib/relaton_ieee/data_fetcher.rb +30 -7
- data/lib/relaton_ieee/data_parser.rb +18 -6
- data/lib/relaton_ieee/hit_collection.rb +18 -14
- data/lib/relaton_ieee/ieee_bibliography.rb +3 -3
- data/lib/relaton_ieee/pub_id.rb +149 -0
- data/lib/relaton_ieee/rawbib_id_parser.rb +515 -0
- data/lib/relaton_ieee/scrapper.rb +40 -47
- data/lib/relaton_ieee/version.rb +1 -1
- data/lib/relaton_ieee.rb +1 -0
- data/relaton_ieee.gemspec +1 -1
- metadata +7 -4
@@ -0,0 +1,515 @@
|
|
1
|
+
require "relaton_ieee/pub_id"
|
2
|
+
|
3
|
+
module RelatonIeee
|
4
|
+
module RawbibIdParser
|
5
|
+
STAGES = 'DIS\d?|PSI|FCD|FDIS|CD\d?|Pub2|CDV|TS|SI'.freeze
|
6
|
+
APPROVAL = '(?:\s(Unapproved|Approved))'.freeze
|
7
|
+
APPROV = '(?:\s(?:Unapproved|Approved))?'.freeze
|
8
|
+
STD = "(?:\s(?i)Std\.?(?-i))?".freeze
|
9
|
+
|
10
|
+
#
|
11
|
+
# Parse normtitle
|
12
|
+
#
|
13
|
+
# @param [String] normtitle <description>
|
14
|
+
#
|
15
|
+
# @return [RelatonIeee::PubId, nil]
|
16
|
+
#
|
17
|
+
def parse(normtitle) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
18
|
+
case normtitle
|
19
|
+
# when "2012 NESC Handbook, Seventh Edition" then "NESC HBK ED7.2012"
|
20
|
+
# when "2017 NESC(R) Handbook, Premier Edition" then "NESC HBK ED1.2017"
|
21
|
+
# when "2017 National Electrical Safety Code(R) (NESC(R)) - Redline" then "NESC C2R.2017"
|
22
|
+
# when "2017 National Electrical Safety Code(R) (NESC(R))" then "NESC C2.2017"
|
23
|
+
# when /^(\d+HistoricalData)-(\d{4})/ then "IEEE #{$1}.#{$2}"
|
24
|
+
# when /^(\d+)\.(\w+)\sBattery\sLife\sImprovement/ then "IEEE #{$1}-#{$2}"
|
25
|
+
# when /^(\d+)\.(\w+)-(\d{4})\s\(Amendment/ then "IEEE #{$1}-#{$2}.#{$3}"
|
26
|
+
when "A.I.E.E. No. 15 May-1928" then PubId.new(publisher: "AIEE", number: "15", year: "1928", month: "05")
|
27
|
+
# when "AIEE Nos 72 and 73 - 1932" then "AIEE 72_73.1932"
|
28
|
+
when "IEEE Std P1073.1.3.4/D3.0" then PubId.new(publisher: "IEEE", number: "P11073", part: "00101") # "IEEE P11073-00101"
|
29
|
+
# 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"
|
30
|
+
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"
|
31
|
+
when "IEEE P802.1Qbu/03.0, July 2015" # "IEEE P802.1Qbu/D3.0.2015"
|
32
|
+
PubId.new(publisher: "IEEE", number: "P802", part: "1Qbu", draft: "3.0", year: "2015")
|
33
|
+
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
|
+
when "IEEE P802.11aqTM/013.0 October 2017" # "IEEE P802-11aqTM/D13.0.2017"
|
36
|
+
PubId.new(publisher: "IEEE", number: "P802", part: "11aqTM", draft: "13.0", year: "2017")
|
37
|
+
when "IEEE P844.3/C22.2 293.3/D0, August 2018" # "IEEE P844-3/C22.2-293.3/D0.2018"
|
38
|
+
PubId.new([{ publisher: "IEEE", number: "P844", part: "3" },
|
39
|
+
{ number: "C22.2", part: "293.3", dtaft: "0", year: "2018" }])
|
40
|
+
when "IEEE P844.3/C22.2 293.3/D1, November 2018" # "IEEE P844.3/C22.2 293.3/D1.2018"
|
41
|
+
PubId.new([{ publisher: "IEEE", number: "P844", part: "3" },
|
42
|
+
{ number: "C22.2", part: "293.3", draft: "1", year: "2018" }])
|
43
|
+
when "AIEE No 431 (105) -1958" then PubId.new(publisher: "AIEE", number: "431", year: "1958") # "AIEE 431.1958"
|
44
|
+
when "IEEE 1076-CONC-I99O" then PubId.new(publisher: "IEEE", number: "1076", year: "199O") # "IEEE 1076.199O"
|
45
|
+
when "IEEE Std 960-1993, IEEE Std 1177-1993" # "IEEE 960/1177.1993"
|
46
|
+
PubId.new([{ publisher: "IEEE", number: "960" }, { number: "1177", year: "1993" }])
|
47
|
+
when "IEEE P802.11ajD8.0, August 2017" # "IEEE P802-11aj/D8.0.2017"
|
48
|
+
PubId.new(publisher: "IEEE", number: "P802", part: "11aj", draft: "8.0", year: "2017")
|
49
|
+
when "IEEE P802.11ajD9.0, November 2017" # "IEEE P802-11aj/D9.0.2017"
|
50
|
+
PubId.new(publisher: "IEEE", number: "P802", part: "11aj", draft: "9.0", year: "2017")
|
51
|
+
when "ISO/IEC/IEEE P29119-4-DISMay2013" # "ISO/IEC/IEEE DIS P29119-4.2013"
|
52
|
+
PubId.new(publisher: "ISO/IEC/IEEE", stage: "DIS", number: "P29119", part: "4", year: "2013")
|
53
|
+
when "IEEE-P15026-3-DIS-January 2015" # "IEEE DIS P15026-3.2015"
|
54
|
+
PubId.new(publisher: "IEEE", stage: "DIS", number: "P15026", year: "2015")
|
55
|
+
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
|
+
when "IEC/IEEE P62271-37-013:2015 D13.4" # "IEC/IEEE P62271-37-013/D13.4.2015"
|
58
|
+
PubId.new(publisher: "IEC/IEEE", number: "P62271", part: "37-013", draft: "13.4", year: "2015")
|
59
|
+
when "PC37.30.2/D043 Rev 18, May 2015" # "IEEE PC37-30-2/D043/REV-18.2015"
|
60
|
+
PubId.new(publisher: "IEEE", number: "PC37", part: "30-2", draft: "043", rev: "18", year: "2015")
|
61
|
+
when "IEC/IEEE FDIS 62582-5 IEC/IEEE 2015" # "IEC/IEEE FDIS 62582-5.2015"
|
62
|
+
PubId.new(publisher: "IEC/IEEE", stage: "FDIS", number: "62582", part: "5", year: "2015")
|
63
|
+
when "ISO/IEC/IEEE P15289:2016, 3rd Ed FDIS/D2" # "ISO/IEC/IEEE FDIS P15289/E3/D2.2016"
|
64
|
+
PubId.new(publisher: "ISO/IEC/IEEE", stage: "FDIS", number: "P15289", part: "", edition: "3", draft: "2", year: "2016")
|
65
|
+
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
|
+
when "Draft IEEE P802.15.4REVi/D09, April 2011 (Revision of IEEE Std 802.15.4-2006)"
|
68
|
+
PubId.new(publisher: "IEEE", number: "P802", part: "15.4", rev: "i", draft: "09", year: "2011", month: "04")
|
69
|
+
when "ISO/IEC/IEEE DIS P42020:201x(E), June 2017"
|
70
|
+
PubId.new(publisher: "ISO/IEC/IEEE", stage: "DIS", number: "P42020", year: "2017", month: "06")
|
71
|
+
when "IEEE/IEC P62582 CD2 proposal, May 2017"
|
72
|
+
PubId.new(publisher: "IEEE/IEC", number: "P62582", stage: "CD2", year: "2017", month: "05")
|
73
|
+
when "ISO/IEC/IEEE P16326:201x WD.4a, July 2017"
|
74
|
+
PubId.new(publisher: "ISO/IEC/IEEE", number: "P16326", draft: "4a", year: "2017", month: "07")
|
75
|
+
when "ISO/IEC/IEEE CD.1 P21839, October 2017"
|
76
|
+
PubId.new(publisher: "ISO/IEC/IEEE", stage: "CD1", number: "P21839", year: "2017", month: "10")
|
77
|
+
when "IEEE P3001.2/D5, August 2017"
|
78
|
+
PubId.new(publisher: "IEEE", number: "P3001", part: "2", draft: "5", year: "2017", month: "01")
|
79
|
+
when "P3001.2/D5, August 2017"
|
80
|
+
PubId.new(publisher: "IEEE", number: "P3001", part: "2", draft: "5", year: "2017", month: "12")
|
81
|
+
when "ISO/IEC/IEEE P16326:201x WD5, December 2017"
|
82
|
+
PubId.new(publisher: "ISO/IEC/IEEE", number: "P16326", draft: "5", year: "2017", month: "12")
|
83
|
+
when "ISO/IEC/IEEE DIS P16326/201x, December 2018"
|
84
|
+
PubId.new(publisher: "ISO/IEC/IEEE", stage: "DIS", number: "P16326", year: "2018", month: "12")
|
85
|
+
when "ISO/IEC/IEEE/P21839, 2019(E)"
|
86
|
+
PubId.new(publisher: "ISO/IEC/IEEE", number: "P21839", year: "2019")
|
87
|
+
when "ISO/IEC/IEEE P42020/V1.9, August 2018"
|
88
|
+
PubId.new(publisher: "ISO/IEC/IEEE", number: "P42020", year: "2018", month: "08")
|
89
|
+
when "ISO/IEC/IEEE CD2 P12207-2: 201x(E), February 2019"
|
90
|
+
PubId.new(publisher: "ISO/IEC/IEEE", stage: "CD2", number: "P12207", part: "2", year: "2019", month: "02")
|
91
|
+
when "ISO/IEC/IEEE P42010.WD4:2019(E)"
|
92
|
+
PubId.new(publisher: "ISO/IEC/IEEE", number: "P42010", draft: "4", year: "2019")
|
93
|
+
when "IEC/IEEE P63195_CDV/V3, February 2020"
|
94
|
+
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
|
+
when "IEEE/ISO/IEC P42010.CD1-V1.0, April 2020"
|
98
|
+
PubId.new(publisher: "IEEE/ISO/IEC", number: "P42010", stage: "CD1", year: "2020", month: "04")
|
99
|
+
when "ISO/IEC/IEEE/P16085_DIS, March 2020"
|
100
|
+
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
|
+
when "ANSI/IEEE Std: Outdoor Apparatus Bushings"
|
105
|
+
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
|
+
when "Unapproved Draft Std ISO/IEC FDIS 15288:2007(E) IEEE P15288/D3,"
|
108
|
+
PubId.new(publisher: "ISO/IEC/IEEE", stage: "FDIS", number: "P15288", draft: "3", year: "2007")
|
109
|
+
when "Draft National Electrical Safety Code, January 2016"
|
110
|
+
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
|
+
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
|
+
when "IEEE Unapproved Draft Std P802.1AB/REVD2.2, Dec 2007" # "IEEE P802.1AB/REV/D2.2.2007"
|
115
|
+
PubId.new(publisher: "IEEE", number: "P802", part: "1AB", rev: "", draft: "2.2", year: "2007", month: "12")
|
116
|
+
|
117
|
+
# drop all with <standard_id>0</standard_id>
|
118
|
+
# when "IEEE Std P1671/D5, June 2006", "IEEE Std PC37.100.1/D8, Dec 2006",
|
119
|
+
# "IEEE Unapproved Draft Std P1578/D17, Mar 2007", "IEEE Approved Draft Std P1115a/D4, Feb 2007",
|
120
|
+
# "IEEE Std P802.16g/D6, Nov 06", "IEEE Unapproved Draft Std P1588_D2.2, Jan 2008",
|
121
|
+
# "IEEE Unapproved Std P90003/D1, Feb 2007.pdf", "IEEE Unapproved Draft Std PC37.06/D10 Dec 2008",
|
122
|
+
# "IEEE P1451.2/D20, February 2011", "IEEE Std P1641.1/D3, July 2006",
|
123
|
+
# "IEEE P802.1AR-Rev/D2.2, September 2017 (Draft Revision of IEEE Std 802.1AR\u20132009)",
|
124
|
+
# "IEEE Std 108-1955; AIEE No.450-April 1955", "IEEE Std 85-1973 (Revision of IEEE Std 85-1965)",
|
125
|
+
# "IEEE Std 1003.1/2003.l/lNT, March 1994 Edition" then nil
|
126
|
+
|
127
|
+
# publisher1, number1, part1, publisher2, number2, part2, draft, year
|
128
|
+
when /^([A-Z\/]+)\s(\w+)[-.](\d+)\/(\w+)\s(\w+)[-.](\d+)_D([\d.]+),\s\w+\s(\d{4})/
|
129
|
+
PubId.new([{ publisher: $1, number: $2, part: $3 },
|
130
|
+
{ publisher: $4, number: $5, part: $6, draft: dn($7), year: $8 }])
|
131
|
+
|
132
|
+
# publisher1, number1, part1, number2, part2, draft, year, month
|
133
|
+
when /^([A-Z\/]+)\s(\w+)[.-]([\w.-]+)\/(\w+)[.-]([[:alnum:].-]+)[\/_]D([\w.]+),\s(\w+)\s(\d{4})/
|
134
|
+
PubId.new([{ publisher: $1, number: $2, part: sp($3) }, { number: $4, part: sp($5), draft: dn($6), year: $8, month: mn($7) }])
|
135
|
+
|
136
|
+
# publisher, approval, number, part, corrigendum, draft, year
|
137
|
+
when /^([A-Z\/]+)#{APPROVAL}(?:\sDraft)?\sStd\s(\w+)\.(\d+)-\d{4}[^\/]*\/Cor\s?(\d)\/(D[\d\.]+),\s(?:\w+\s)?(\d{4})/o
|
138
|
+
PubId.new(publisher: $1, approval: $2, number: $3, part: sp($4), corr: $5, draft: dn($6), year: $7)
|
139
|
+
|
140
|
+
# publisher, number, part, corrigendum, draft, year, month
|
141
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\.(\w+)-\d{4}\/Cor\s?(\d(?:-\d+x)?)[\/_]D([\d\.]+),\s?(\w+)\s(\d{4})/o
|
142
|
+
PubId.new(publisher: $1, number: $2, part: $3, corr: $4, draft: dn($5), month: mn($6), year: $7)
|
143
|
+
|
144
|
+
# publidsher1, number1, year1 publisher2, number2, draft, year2
|
145
|
+
when /^([A-Z\/]+)\s(\w+)-(\d{4})\/([A-Z]+)\s([[:alnum:]]+)_D([\w.]+),\s(\d{4})/
|
146
|
+
PubId.new([{ publisher: $1, number: $2, year: $3 }, { publisher: $4, number: $5, draft: dn($6), year: $7 }])
|
147
|
+
|
148
|
+
when /^([A-Z\/]+)\s(#{STAGES})\s(\w+)[.-]([[:alnum:].-]+)[\s\/_]ED([\w.]+),\s(\w+)\s(\d{4})/o
|
149
|
+
PubId.new(publisher: $1, stage: $2, number: $3, part: sp($4), edition: $5, month: mn($6), year: $7)
|
150
|
+
|
151
|
+
# publidsher1, number1, publisher2, number2, draft, year
|
152
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\/([A-Z]+)\s([[:alnum:]]+)_D([\d\.]+),\s\w+\s(\d{4})/o,
|
153
|
+
/^([A-Z\/]+)\s(\w+)\sand\s([A-Z]+)(?:\sGuideline)?\s([[:alnum:]]+)\/D([\d\.]+),\s\w+\s(\d{4})/o
|
154
|
+
PubId.new([{ publisher: $1, number: $2 }, { publisher: $3, number: $4, draft: dn($5), year: $6 }])
|
155
|
+
|
156
|
+
# publidsher1, number1, part, publisher2, number2, year
|
157
|
+
when /^([A-Z\/]+)\s(\w+)\.(\d+)_(\w+)\s(\w+),\s(\d{4})/ # "#{$1} #{$2}-#{$3}/#{$4} #{$5}.#{$6}"
|
158
|
+
PubId.new([{ publisher: $1, number: $2, part: $3 }, { publisher: $4, number: $5, year: $6 }])
|
159
|
+
|
160
|
+
# publisher, number1, part1, number2, part2, draft
|
161
|
+
when /^([A-Z\/]+)\s(\w+)[.-](\d+)\/(\w+)\.(\d+)[\/_]D([\d.]+)/ # "#{$1} #{$2}-#{$3}/#{$4}-#{$5}/D#{$6}"
|
162
|
+
PubId.new([{ publisher: $1, number: $2, part: $3 }, { number: $4, part: $5, draft: dn($6) }])
|
163
|
+
|
164
|
+
# publidsher, number1, part1, number2, part2, year
|
165
|
+
when /^([A-Z\/]+)\sStd\s(\w+)\.(\w+)\/(\w+)\.(\w+)\/INT\s\w+\s(\d{4})/
|
166
|
+
PubId.new([{ publisher: $1, number: $2, part: $3 }, { number: $4, part: $5, year: $6 }])
|
167
|
+
|
168
|
+
# publisher, number, part, corrigendum, draft, year
|
169
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)[.-]([\d-]+)\/Cor\s?(\d)[\/_]D([\d\.]+),\s(?:\w+\s)?(\d{4})/o,
|
170
|
+
/^([A-Z\/]+)\s(\w+)[.-](\d+)-\d{4}\/Cor\s?(\d)(?:-|,\s|\/)D([\d.]+),?\s\w+\s(\d{4})/,
|
171
|
+
/^([A-Z\/]+)\s(\w+)\.([[:alnum:].]+)[-_]Cor[\s-]?(\d)\/D([\d.]+),?\s\w+\s(\d{4})/
|
172
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), corr: $4, draft: dn($5), year: $6)
|
173
|
+
when /^([A-Z\/]+)\s(\w+)\.(\d+)-\d{4}\/Cor(\d)-(\d{4})\/D([\d.]+)/ # "#{$1} #{$2}-#{$3}/Cor#{$4}/D#{$6}.#{$5}"
|
174
|
+
PubId.new(publisher: $1, number: $2, part: $3, corr: $4, draft: dn($6), year: $5)
|
175
|
+
|
176
|
+
# publisher, status, number, part, draft, year, month
|
177
|
+
when /^([A-Z\/]+)(\sActive)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)[.-]([[:alnum:]\.]+)\s?[\/_]D([\w\.]+),?\s(\w+)(?:\s\d{1,2},)?\s?(\d{2,4})/o
|
178
|
+
PubId.new(publisher: $1, status: $2, number: $3, part: sp($4), draft: dn($5), year: $7, month: mn($6))
|
179
|
+
|
180
|
+
# publisher, approval, number, part, draft, year, month
|
181
|
+
when /^([A-Z\/]+)(?:\sActive)?#{APPROVAL}(?:\sDraft)?#{STD}\s(\w+)[.-]([[:alnum:]\.]+)\s?[\/_]D([\w\.-]+),?\s(\w+)(?:\s\d{1,2},)?\s?(\d{2,4})/o
|
182
|
+
PubId.new(publisher: $1, approval: $2, number: $3, part: sp($4), draft: dn($5), year: $7, month: mn($6))
|
183
|
+
when /^([A-Z\/]+)\s(\w+)\.([\w.]+)\/D([\w.]+),?\s(\w+)[\s_](\d{4})(?:\s-\s\(|\s\(|_)(Unapproved|Approved)/
|
184
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), draft: dn($4), year: $6, month: mn($5), approval: $7)
|
185
|
+
|
186
|
+
# publisher, approval, number, draft, year, month
|
187
|
+
when /^([A-Z\/]+)\s(\w+)\/D([\w.]+),\s(\w+)\s(\d{4})\s-\s\(?(Approved|Unapproved)/
|
188
|
+
PubId.new(publisher: $1, number: $2, draft: dn($3), year: $5, month: mn($4), approval: $6)
|
189
|
+
|
190
|
+
# publisher, approval, number, part, draft, year
|
191
|
+
when /^([A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s(\w+)[.-]([\w.]+)\s?[\/_\s]D([\w\.]+),?\s\w+\s?(\d{4})/o
|
192
|
+
PubId.new(publisher: $1, approval: $2, number: $3, part: sp($4), draft: dn($5), year: $6)
|
193
|
+
when /^([A-Z\/]+)\s(\w+)\.([\w.]+)\/D([\d.]+),?\s\w+[\s_](\d{4})(?:\s-\s\(|_|\s\()?#{APPROVAL}/o
|
194
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), draft: dn($4), year: $5, approval: $6)
|
195
|
+
|
196
|
+
# publisher, stage, number, part, edition, year, month
|
197
|
+
when /^([A-Z\/]+)\s(\w+)[.-]([[:alnum:].-]+)[\/_](#{STAGES})\s(\w+)\sedition,\s(\w+)\s(\d{4})/o
|
198
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), stage: $4, edition: en($5), month: mn($6), year: $7)
|
199
|
+
|
200
|
+
# number, part, corrigendum, draft, year
|
201
|
+
when /^(\w+)\.([\w.]+)-\d{4}[_\/]Cor\s?(\d)\/D([\w.]+),?\s\w+\s(?:\d{2},\s)?(\d{4})/
|
202
|
+
PubId.new(number: $1, part: sp($2), corr: $3, draft: dn($4), year: $5)
|
203
|
+
|
204
|
+
# publisher, approval, number, part, draft
|
205
|
+
when /^([A-Z\/]+)\s(\w+)\.(\d+)\/D([\d.]+)\s\([^)]+\)\s-#{APPROVAL}/o
|
206
|
+
PubId.new(publisher: $1, approval: $5, number: $2, part: $3, draft: dn($4))
|
207
|
+
|
208
|
+
# publisher, number, part1, rev, draft, part2
|
209
|
+
when /^([A-Z\/]+)#{STD}\s(\w+)\.([\d.]+)REV([a-z]+)_D([\w.]+)\sPart\s(\d)/o
|
210
|
+
PubId.new(publisher: $1, number: $2, part: "#{sp($3)}-#{$6}", rev: $4, draft: dn($5))
|
211
|
+
|
212
|
+
# publisher, number, part, draft, year, month
|
213
|
+
when /^([A-Z\/]+)#{STD}\s(\w+)[.-]([[:alnum:].]+)[\/\s_]D([\d.]+)(?:,?\s|_)([[:alpha:]]+)[\s_]?(\d{4})/o
|
214
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), draft: dn($4), year: $6, month: mn($5))
|
215
|
+
|
216
|
+
# publisher, stage, number, part, draft, year
|
217
|
+
when /^([\w\/]+)\s(#{STAGES})\s(\w+)-([[:alnum:]]+)[\/_\s]D([\d.]+),\s\w+\s(\d{4})/o
|
218
|
+
PubId.new(publisher: $1, stage: $2, number: $3, part: sp($4), draft: dn($5), year: $6)
|
219
|
+
|
220
|
+
# publisher, number, part, rev, draft, year, month
|
221
|
+
when /^([A-Z\/]+)\s(\w+)\.([\w.]+)-Rev\/D([\w.]+),\s(\w+)\s(\d{4})/
|
222
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), rev: "", draft: dn($4), year: $6, month: mn($5))
|
223
|
+
|
224
|
+
# publisher, number, part, rev, draft, year
|
225
|
+
when /^([A-Z\/]+)\s(\w+)\.([\d.]+)Rev(\w+)-D([\w.]+),\s\w+\s(\d{4})/
|
226
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), rev: $4, draft: dn($5), year: $6)
|
227
|
+
|
228
|
+
# publisher, stage, number, part, edition, year
|
229
|
+
when /^([A-Z\/]+)\s(#{STAGES})\s(\w+)[.-]([[:alnum:].-]+)[\/\s_]ED([\d.]+),\s(\d{4})/o
|
230
|
+
PubId.new(publisher: $1, stage: $2, number: $3, part: sp($4), edition: $5, year: $6)
|
231
|
+
|
232
|
+
# publisher, stage, number, draft, year, month
|
233
|
+
when /^([A-Z\/]+)\s(\w+)\/(#{STAGES})[\/_]D([\w.]+),\s(\w+)\s(\d{4})/o
|
234
|
+
PubId.new(publisher: $1, number: $2, stage: $3, draft: dn($4), year: $6, month: mn($5))
|
235
|
+
|
236
|
+
# number, part, draft, year, month
|
237
|
+
when /(\w+)[.-]([[:alnum:].]+)[\/\s_]D([\d.]+)(?:,?\s|_)([[:alpha:]]+)[\s_]?(\d{4})/
|
238
|
+
PubId.new(publisher: "IEEE", number: $1, part: sp($2), draft: dn($3), year: $5, month: mn($4))
|
239
|
+
|
240
|
+
# number, corrigendum, draft, year, month
|
241
|
+
when /^(\w+)-\d{4}[\/_]Cor\s?(\d)[\/_]D([\w.]+),\s(\w+)\s(\d{4})/
|
242
|
+
PubId.new(publisher: "IEEE", number: $1, corr: $2, draft: dn($3), month: mn($4), year: $5)
|
243
|
+
|
244
|
+
# publisher, number, corrigendum, draft, year
|
245
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?\sStd\s(\w+)(?:-\d{4})?[\/_]Cor\s?(\d)\/D([\d\.]+),\s\w+\s(\d{4})/o
|
246
|
+
PubId.new(publisher: $1, number: $2, corr: $3, draft: dn($4), year: $5)
|
247
|
+
|
248
|
+
# publisher, number, part, rev, corrigendum, draft
|
249
|
+
when /^([A-Z\/]+)\s(\w+)\.(\w+)-\d{4}-Rev\/Cor(\d)\/D([\d.]+)/
|
250
|
+
PubId.new(publisher: $1, number: $2, part: $3, rev: "", corr: $4, draft: dn($5))
|
251
|
+
|
252
|
+
# publisher, number, part, corrigendum, draft
|
253
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\.([\w.]+)\/[Cc]or\s?(\d)\/D([\w\.]+)/o,
|
254
|
+
/^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\.(\w+)-\d{4}\/Cor\s?(\d)[\/_]D([\d\.]+)/o
|
255
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), corr: $4, draft: dn($5))
|
256
|
+
|
257
|
+
# publisher, number, part, corrigendum, year
|
258
|
+
when /^([A-Z\/]+)#{STD}\s(\w+)[.-]([\w.]+)[:-]\d{4}[\/-]Cor[\s.]?(\d)[:-](\d{4})/o
|
259
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), corr: $4, year: $5)
|
260
|
+
|
261
|
+
# publisher, number, part, draft, year
|
262
|
+
when /^([\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s(\w+)[.-]([[:alnum:]\.]+)(?:\s?\/\s?|_|,\s|-)D([\w\.]+)\s?,?\s\w+(?:\s\d{1,2},)?\s?(\d{2,4})/o,
|
263
|
+
/^([A-Z\/]+)#{STD}\s(\w+)[.-]([\w.-]+)[\/\s]D([\w.]*)(?:-|,\s?\w+\s|\s\w+:|,\s)(\d{4})/o,
|
264
|
+
/^([\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s(\w+)[.-]([[:alnum:]\.]+)\sDraft\s([\w\.]+),\s\w+\s(\d{4})/o
|
265
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), draft: dn($4), year: $5)
|
266
|
+
|
267
|
+
# publisher, approval, number, draft, year
|
268
|
+
when /^([A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s([[:alnum:]]+)\s?[\/_]\s?D([\w\.]+),?\s\w+\s(\d{2,4})/o
|
269
|
+
PubId.new(publisher: $1, approval: $2, number: $3, draft: dn($4), year: $5)
|
270
|
+
when /^([A-Z\/]+)\s(\w+)\/D([\d.]+),\s\w+[\s_](\d{4})(?:\s-\s\(?|_)?#{APPROVAL}/o
|
271
|
+
PubId.new(publisher: $1, number: $2, draft: dn($3), year: $4, approval: $5)
|
272
|
+
|
273
|
+
# publisher, number, part, rev, draft
|
274
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\.([\w.]+)[-\s\/]?REV-?(\w+)\/D([\d.]+)/o
|
275
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), rev: $4, draft: dn($5))
|
276
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\.([\w.]+)-REV\/D([\d.]+)/o
|
277
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), rev: "", draft: dn($4))
|
278
|
+
|
279
|
+
# publisher, number, part, rev, year
|
280
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?\sStd\s(\w+)\.(\d+)\/rev(\d+),\s\w+\s(\d+)/o
|
281
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), rev: $4, year: $5)
|
282
|
+
|
283
|
+
# publisher, stage, number, draft, year
|
284
|
+
when /^([\w\/]+)\s(#{STAGES})\s([[:alnum:]]+)[\/_]D([\w.]+),(?:\s\w+)?\s(\d{4})/o
|
285
|
+
PubId.new(publisher: $1, stage: $2, number: $3, draft: dn($4), year: $5)
|
286
|
+
|
287
|
+
# publisher, stage, number, part, year, month
|
288
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)[.-]([[:alnum:].-]+)(?:[\/_-]|,\s)(#{STAGES}),?\s(\w+)\s(\d{4})/o
|
289
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), stage: $4, year: $6, month: mn($5))
|
290
|
+
when /^([A-Z\/]+)\s(#{STAGES})\s(\w+)[.-](\w+),\s(\w+)\s(\d{4})/o
|
291
|
+
PubId.new(publisher: $1, number: $3, part: sp($4), stage: $2, year: $6, month: mn($5))
|
292
|
+
|
293
|
+
# publisher, number, part, edition, year, month
|
294
|
+
when /^([A-Z\/]+)\s(\w+)[.-]([\w.-]+)[\/\s]ED([\d+]),\s(\w+)\s(\d{4})/
|
295
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), edition: $4, month: mn($5), year: $6)
|
296
|
+
|
297
|
+
# publisher, stage, number, part, year
|
298
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)[.-](\d+)[\/_-](#{STAGES}),?\s\w+\s(\d{4})/o,
|
299
|
+
/^([A-Z\/]+)\s(\w+)-(\d+)[\/-](#{STAGES})(?:_|,\s|-)\w+\s?(\d{4})/o,
|
300
|
+
/^([A-Z\/]+)\s(\w+)[.-](\d+)[\/-_](#{STAGES})[\s-](\d{4})/o
|
301
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), stage: $4, year: $5)
|
302
|
+
when /^([A-Z\/]+)\s(#{STAGES})\s(\w+)-([\w-]+),\s(\d{4})/o
|
303
|
+
PubId.new(publisher: $1, number: $3, part: sp($4), stage: $2, year: $5)
|
304
|
+
|
305
|
+
# publisher, stage, number, year, month
|
306
|
+
when /^([A-Z\/]+)\s(#{STAGES})\s(\w+)(?:\s\g<2>)?,\s(\w+)\s(\d{4})/o
|
307
|
+
PubId.new(publisher: $1, number: $3, stage: $2, year: $5, month: mn($4))
|
308
|
+
when /^([A-Z\/]+)\s([[:alnum:]]+)(?:\s|_|\/\s?)?(#{STAGES}),?\s(\w+)\s(\d{4})/o
|
309
|
+
PubId.new(publisher: $1, number: $2, stage: $3, year: $5, month: mn($4))
|
310
|
+
|
311
|
+
# publisher, stage, number, part, draft
|
312
|
+
when /^([A-Z\/]+)[.-]([[:alnum:].-]+)[\/_]D([[:alnum:].]+)[\/_](#{STAGES})/o
|
313
|
+
PubId.new(publisher: "IEEE", number: $1, part: sp($2), draft: dn($3), stage: $4)
|
314
|
+
|
315
|
+
# publisher, stage, number, year
|
316
|
+
when /^([A-Z\/]+)\s(#{STAGES})\s(\w+)(?:,\s\w+\s|:)(\d{4})/o
|
317
|
+
PubId.new(publisher: $1, number: $3, stage: $2, year: $4)
|
318
|
+
when /^([A-Z\/]+)\s(\w+)(?:\/|,\s)(#{STAGES})-(\d{4})/o
|
319
|
+
PubId.new(publisher: $1, number: $2, stage: $3, year: $4)
|
320
|
+
|
321
|
+
# publisher, stage, number, part
|
322
|
+
when /^([A-Z\/]+)\s(\w+)-([\w-]+)[\s-](#{STAGES})/o
|
323
|
+
PubId.new(publisher: $1, number: $2, part: $3, stage: $4)
|
324
|
+
when /^([A-Z\/]+)\s(\w+)-(#{STAGES})-(\w+)/o
|
325
|
+
PubId.new(publisher: $1, number: $2, part: $4, stage: $3)
|
326
|
+
when /^([A-Z\/]+)\s(#{STAGES})\s(\w+)[.-]([[:alnum:].-]+)/o
|
327
|
+
PubId.new(publisher: $1, number: $3, part: sp($4), stage: $2)
|
328
|
+
|
329
|
+
# publisher, number, corrigendum, year
|
330
|
+
when /^([A-Z\/]+)#{STD}\s(\w+)-\d{4}\/Cor\s?(\d)-(\d{4})/o
|
331
|
+
PubId.new(publisher: $1, number: $2, corrigendum: $3, year: $4)
|
332
|
+
|
333
|
+
# publisher, number, rev, draft
|
334
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)-REV\/D([\d.]+)/o
|
335
|
+
PubId.new(publisher: $1, number: $2, rev: "", draft: dn($3))
|
336
|
+
|
337
|
+
# publisher, number, part, year, month
|
338
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)-([\w-]+),\s(\w+)\s?(\d{4})/o,
|
339
|
+
/^([A-Z\/]+)\sStd\s(\w+)\.(\w+)-\d{4}\/INT,?\s(\w+)\.?\s(\d{4})/
|
340
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), year: $5, month: mn($4))
|
341
|
+
|
342
|
+
# publisher, number, part, amendment, year
|
343
|
+
when /^([A-Z\/]+)#{STD}\s(\w+)-(\w+)[:-](\d{4})\/Amd(?:\s|.\s?)?(\d)/o
|
344
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), amd: $5, year: $4)
|
345
|
+
|
346
|
+
# publisher, number, part, year, redline
|
347
|
+
when /^([A-Z\/]+)#{STD}\s(\w+)[.-]([\w.]+)[:-](\d{4}).*?\s-\s(Redline)/o,
|
348
|
+
/^([A-Z\/]+)#{STD}\s(\w+)[.-]([\w.-]+):(\d{4}).*?\s-\s(Redline)/o
|
349
|
+
PubId.new(publisher: $1, number: $2, part: $3, year: $4, redline: true)
|
350
|
+
|
351
|
+
# publisher, number, part, year
|
352
|
+
when /^([A-Z\/]+)\s(\w+)-(\d{1,3}),\s\w+\s(\d{4})/,
|
353
|
+
/^([A-Z\/]+)#{STD}\s(\w+)[.-](?!(?:19|20)\d{2}\D)([\w.]+)(?:,\s\w+\s|-|:|,\s|\.|:)(\d{4})/o,
|
354
|
+
/^([A-Z\/]+)#{STD}\s(\w+)[.-](?!(?:19|20)\d{2}\D)([\w.-]+)(?:,\s\w+\s|:|,\s|\.|:)(\d{4})/o,
|
355
|
+
/^([A-Z\/]+)#{STD}\sNo(?:\.?\s|\.)(\w+)\.(\d+)\s?-(?:\w+\s)?(\d{4})/o
|
356
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), year: $4)
|
357
|
+
|
358
|
+
# publisher, number, edition, year
|
359
|
+
when /^([A-Z\/]+)\s(\w+)\s(\w+)\sEdition,\s\w+\s(\d+)/,
|
360
|
+
/^([A-Z\/]+)\s(\w+)[\/_]ED([\d.]+),\s(\d{4})/
|
361
|
+
PubId.new(publisher: $1, number: $2, edition: en($3), year: $4)
|
362
|
+
|
363
|
+
# publisher, number, part, conformance, draft
|
364
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\.([[:alnum:].]+)[\/-]Conformance(\d+)[\/_]D([\w\.]+)/o
|
365
|
+
PubId.new(publisher: $1, number: $2, part: "#{sp($3)}-#{$4}", draft: dn($5))
|
366
|
+
|
367
|
+
# publisher, number, part, conformance, year
|
368
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\.([[:alnum:].]+)\s?\/\s?Conformance(\d+)-(\d{4})/o
|
369
|
+
PubId.new(publisher: $1, number: $2, part: "#{sp($3)}-#{$4}", year: $5)
|
370
|
+
|
371
|
+
# publisher, number, part, draft
|
372
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\.([[:alnum:].]+)[^\/]*\/D([[:alnum:]\.]+)/o,
|
373
|
+
/^([A-Z\/]+)\s(\w+)[.-]([[:alnum:]-]+)[\s_]D([\d.]+)/,
|
374
|
+
/^([A-Z\/]+)\s(\w+)-(\w+)\/D([\w.]+)/
|
375
|
+
PubId.new(publisher: $1, number: $2, part: sp($3), draft: dn($4))
|
376
|
+
|
377
|
+
# number, part, draft, year
|
378
|
+
when /^(\w+)[.-]([[:alnum:].-]+)(?:\/|,\s|_)D([\d.]+),?\s(?:\w+,?\s)?(\d{4})/
|
379
|
+
PubId.new(publisher: "IEEE", number: $1, part: sp($2), draft: dn($3), year: $4)
|
380
|
+
|
381
|
+
# publisher, number, draft, year, month
|
382
|
+
when /^([A-Z\/]+)\s(\w+)\/D([\d.]+),\s(\w+)\s(\d{4})/
|
383
|
+
PubId.new(publisher: $1, number: $2, draft: dn($3), year: $5, month: mn($4))
|
384
|
+
|
385
|
+
# publisher, number, draft, year
|
386
|
+
when /^([\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s([[:alnum:]]+)\s?[\/_]\s?D([\w\.-]+),?\s(?:\w+\s)?(\d{2,4})/o,
|
387
|
+
/^([\w\/]+)(?:\sActive)?#{APPROV}(?:\sDraft)?#{STD}\s([[:alnum:]]+)\/?D?([\d\.]+),?\s\w+\s(\d{4})/o,
|
388
|
+
/^([A-Z\/]+)\s(\w+)\/Draft\s([\d.]+),\s\w+\s(\d{4})/
|
389
|
+
PubId.new(publisher: $1, number: $2, draft: dn($3), year: yn($4))
|
390
|
+
when /^([A-Z\/]+)\sStd\s(\w+)-(\d{4})\sDraft\s([\d.]+)/
|
391
|
+
PubId.new(publisher: $1, number: $2, draft: dn($4), year: $3)
|
392
|
+
|
393
|
+
# publisher, approval, number, draft
|
394
|
+
when /^([A-Z\/]+)#{APPROVAL}(?:\sDraft)?#{STD}\s([[:alnum:]]+)[\/_]D([\w.]+)/o
|
395
|
+
PubId.new(publisher: $1, approval: $2, number: $3, draft: dn($4))
|
396
|
+
|
397
|
+
# number, draft, year
|
398
|
+
when /^(\w+)\/D([\w.+]+),?\s\w+,?\s(\d{4})/
|
399
|
+
PubId.new(publisher: "IEEE", number: $1, draft: dn($2), year: $3)
|
400
|
+
|
401
|
+
# number, rev, draft
|
402
|
+
when /^(\w+)-REV\/D([\d.]+)/o
|
403
|
+
PubId.new(publisher: "IEEE", number: $1, rev: "", draft: dn($2))
|
404
|
+
|
405
|
+
# publisher, number, draft
|
406
|
+
when /^([\w\/]+)#{APPROV}(?:\sDraft)?#{STD}\s([[:alnum:]]+)[\/_]D([\w.]+)/o
|
407
|
+
PubId.new(publisher: $1, number: $2, draft: dn($3))
|
408
|
+
|
409
|
+
# publisher, number, year, month
|
410
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)(?:-\d{4})?,\s(\w+)\s(\d{4})/o
|
411
|
+
PubId.new(publisher: $1, number: $2, year: $4, month: mn($3))
|
412
|
+
|
413
|
+
# publisher, number, year, redline
|
414
|
+
when /^([A-Z\/]+)#{STD}\s(\w+)[:-](\d{4}).*?\s-\s(Redline)/o
|
415
|
+
PubId.new(publisher: $1, number: $2, year: $3, redline: true)
|
416
|
+
|
417
|
+
# publisher, number, year
|
418
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)(?:-|:|,\s(?:\w+\s)?)(\d{2,4})/o,
|
419
|
+
/^(\w+)#{APPROV}(?:\sDraft)?\sStd\s(\w+)\/\w+\s(\d{4})/o,
|
420
|
+
/^([\w\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)\/FCD-\w+(\d{4})/o,
|
421
|
+
/^(\w+)#{STD}\sNo(?:\.?\s|\.)(\w+)\s?(?:-|,\s)(?:\w+\s)?(\d{4})/o,
|
422
|
+
/^([A-Z\/]+)\sStd\s(\w+)\/INT-(\d{4})/
|
423
|
+
PubId.new(publisher: $1, number: $2, year: yn($3))
|
424
|
+
when /^ANSI\/\sIEEE#{STD}\s(\w+)-(\d{4})/o
|
425
|
+
PubId.new(publisher: "ANSI/IEEE", number: $1, year: $2)
|
426
|
+
|
427
|
+
# publisher, number, part
|
428
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}\s(\w+)[.-]([\d.]+)/o
|
429
|
+
PubId.new(publisher: $1, number: $2, part: sp($3))
|
430
|
+
|
431
|
+
# number, part, draft
|
432
|
+
when /^(\w+)\.([\w.]+)\/D([\w.]+)/
|
433
|
+
PubId.new(publisher: "IEEE", number: $1, part: sp($2), draft: dn($3))
|
434
|
+
|
435
|
+
# number, part, year
|
436
|
+
when /^(\d{2})\sIRE\s(\w+)[\s.](\w+)/ # "IRE #{$2}-#{$3}.#{yn $1}"
|
437
|
+
PubId.new(publisher: "IRE", number: $2, part: $3, year: yn($1))
|
438
|
+
when /^(\w+)\.(\w+)-(|d{4})/ then PubId.new(publisher: "IEEE", number: $1, part: $2, year: $3)
|
439
|
+
|
440
|
+
# number, year
|
441
|
+
when /^(\w+)-(\d{4})\D/ then PubId.new(publisher: "IEEE", number: $1, year: $2)
|
442
|
+
|
443
|
+
# publisher, number
|
444
|
+
when /^([A-Z\/]+)#{APPROV}(?:\sDraft)?#{STD}(?:\sNo\.?)?\s(\w+)/o
|
445
|
+
PubId.new(publisher: $1, number: $2)
|
446
|
+
|
447
|
+
# else
|
448
|
+
# warn "Failed to parse normtitle #{normtitle}"
|
449
|
+
# nil # normtitle
|
450
|
+
end
|
451
|
+
rescue ArgumentError => e
|
452
|
+
e
|
453
|
+
end
|
454
|
+
|
455
|
+
# replace subpart's delimiter
|
456
|
+
#
|
457
|
+
# @param parts [Strong]
|
458
|
+
#
|
459
|
+
# @return [String]
|
460
|
+
def sp(parts)
|
461
|
+
parts.gsub ".", "-"
|
462
|
+
end
|
463
|
+
|
464
|
+
#
|
465
|
+
# Convert 2 digits year to 4 digits
|
466
|
+
#
|
467
|
+
# @param [String] year
|
468
|
+
#
|
469
|
+
# @return [String, nil] nil if string's length isn't 2 or 4
|
470
|
+
#
|
471
|
+
def yn(year)
|
472
|
+
return year if year.size == 4
|
473
|
+
|
474
|
+
case year.to_i
|
475
|
+
when 0..25 then "20#{year}"
|
476
|
+
when 26..99 then "19#{year}"
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
#
|
481
|
+
# Return number of month
|
482
|
+
#
|
483
|
+
# @param [String] month monthname
|
484
|
+
#
|
485
|
+
# @return [String] 2 digits month number
|
486
|
+
#
|
487
|
+
def mn(month)
|
488
|
+
n = Date::ABBR_MONTHNAMES.index(month) || Date::MONTHNAMES.index(month)
|
489
|
+
return month unless n
|
490
|
+
|
491
|
+
n.to_s.rjust 2, "0"
|
492
|
+
end
|
493
|
+
|
494
|
+
#
|
495
|
+
# Convert edition name to number
|
496
|
+
#
|
497
|
+
# @param [Strin] edition
|
498
|
+
#
|
499
|
+
# @return [String]
|
500
|
+
#
|
501
|
+
def en(edition)
|
502
|
+
case edition
|
503
|
+
when "First" then 1
|
504
|
+
when "Second" then 2
|
505
|
+
else edition
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
509
|
+
def dn(draftnum)
|
510
|
+
draftnum.sub(/^\./, "").gsub "-", "."
|
511
|
+
end
|
512
|
+
|
513
|
+
extend RawbibIdParser
|
514
|
+
end
|
515
|
+
end
|