relaton-iec 1.7.2 → 1.7.3
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_iec/hit_collection.rb +4 -1
- data/lib/relaton_iec/iec_bibliography.rb +22 -9
- data/lib/relaton_iec/scrapper.rb +2 -0
- data/lib/relaton_iec/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: 3398e512749f7c734e53ea2538e6b39ad87d95c175a35dc339b604e20d674ca4
|
4
|
+
data.tar.gz: 7414e6addf0ffc4cc87ff8c9a1fead896b386399d3c33a87602e8cef376cf6c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e60740affa737419167ff5c6fbdaefa4baa53d152a0e92662786bf86ca20fba6dbfeb6c822eaa0f32bd9d24314f80f999e4008ea7117130d6120a7aef05ea2a9
|
7
|
+
data.tar.gz: 4f02935efb8932622d86f70a501a4aeafef0b990362bc0f291e816d29f2c5b6fe9b65198f97378d7906409a34a12853b0b53bda240860228c2251ff1c837ecb8
|
@@ -51,7 +51,10 @@ module RelatonIec
|
|
51
51
|
# @return [Array<RelatonIec::Hit>]
|
52
52
|
def results(uri, part)
|
53
53
|
contains = "[contains(.,'Part #{part}:')]" if part
|
54
|
-
|
54
|
+
resp = OpenURI.open_uri(uri, "User-Agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) "\
|
55
|
+
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36")
|
56
|
+
doc = Nokogiri::HTML(resp)
|
57
|
+
doc.xpath(
|
55
58
|
"//body/li#{contains}",
|
56
59
|
"//ul[contains(@class,'search-results')]/li#{contains}",
|
57
60
|
"//ul[contains(@class,'morethesame')]/li#{contains}"
|
@@ -85,10 +85,16 @@ module RelatonIec
|
|
85
85
|
workers.result.sort_by { |a| a[:i] }.map { |x| x[:hit] }
|
86
86
|
end
|
87
87
|
|
88
|
-
def isobib_search_filter(
|
89
|
-
|
90
|
-
|
91
|
-
|
88
|
+
def isobib_search_filter(reference, year, opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
89
|
+
%r{
|
90
|
+
^(?<code>(?:ISO|IEC)[^\d]*\s[\d-]+\w?)
|
91
|
+
(:(?<year1>\d{4}))?
|
92
|
+
(?<bundle>\+[^\s\/]+)?
|
93
|
+
(\/(?<corr>AMD\s\d+))?
|
94
|
+
}x =~ reference.upcase
|
95
|
+
year ||= year1
|
96
|
+
corr&.sub! " ", ""
|
97
|
+
warn "[relaton-iec] (\"#{reference}\") fetching..."
|
92
98
|
result = search(code, year)
|
93
99
|
if result.empty? && /(?<=-)(?<part>\d+)/ =~ code
|
94
100
|
# try to search packaged standard
|
@@ -97,9 +103,16 @@ module RelatonIec
|
|
97
103
|
else ref = code
|
98
104
|
end
|
99
105
|
result.select do |i|
|
100
|
-
|
101
|
-
|
102
|
-
|
106
|
+
%r{
|
107
|
+
^(?<code2>(?:ISO|IEC)[^\d]*\s\d+(-\w+)?)
|
108
|
+
(:(?<year2>\d{4}))?
|
109
|
+
(?<bundle2>\+[^\s\/]+)?
|
110
|
+
(\/(?<corr2>AMD\d+))?
|
111
|
+
}x =~ i.hit[:code]
|
112
|
+
code2.sub! /(?<=-\d)\w*/, "" if part
|
113
|
+
code2.sub! /-\d+\w*/, "" if opts[:all_parts]
|
114
|
+
ref == code2 && (year.nil? || year == year2) && bundle == bundle2 &&
|
115
|
+
corr == corr2
|
103
116
|
end
|
104
117
|
end
|
105
118
|
|
@@ -160,10 +173,10 @@ module RelatonIec
|
|
160
173
|
{ years: missed_years }
|
161
174
|
end
|
162
175
|
|
163
|
-
def iecbib_get1(code, year,
|
176
|
+
def iecbib_get1(code, year, opts)
|
164
177
|
return iev if code.casecmp("IEV").zero?
|
165
178
|
|
166
|
-
result = isobib_search_filter(code, year) || return
|
179
|
+
result = isobib_search_filter(code, year, opts) || return
|
167
180
|
ret = isobib_results_filter(result, year)
|
168
181
|
if ret[:ret]
|
169
182
|
warn "[relaton-iec] (\"#{code}\") found "\
|
data/lib/relaton_iec/scrapper.rb
CHANGED
data/lib/relaton_iec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.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: 2020-12-
|
11
|
+
date: 2020-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|