relaton-iso 1.0.4 → 1.3.0
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/.rubocop.yml +2 -2
- data/lib/relaton_iso/iso_bibliography.rb +3 -2
- data/lib/relaton_iso/scrapper.rb +10 -8
- data/lib/relaton_iso/version.rb +1 -1
- data/relaton_iso.gemspec +2 -2
- metadata +10 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 24730f7e5d5dbf0d524cd3c2ff3c0b38484d91c27b61a2b66662fcf56125cd46
|
|
4
|
+
data.tar.gz: d432201c27f1a6e9ed53765311af71c976b748bc302b30afb8869dea379435b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd023540869b80f849eae953fde47d471121ff252d003815b2479b4bdd4e6647a65d1675183f8b29d4c08c5eb8e8dbc43c22961fb27e2abf8c1921a65eba8861
|
|
7
|
+
data.tar.gz: 2486c06e8dcee6bb301ccdb477f33b82587d68149d81939b75dfcafaa9f9732a184324ad9c6165d8b6ce142a5bad243517936320a0a7c55ec6ccdbc95f539400
|
data/.rubocop.yml
CHANGED
|
@@ -38,9 +38,10 @@ module RelatonIso
|
|
|
38
38
|
|
|
39
39
|
if year.nil?
|
|
40
40
|
/^(?<code1>[^\s]+(\s\w+)?\s[\d-]+)(:(?<year1>\d{4}))?(?<code2>\s\w+)?/ =~ code
|
|
41
|
+
/:(?<year2>\d{4})/ =~ corr
|
|
41
42
|
unless code1.nil?
|
|
42
43
|
code = code1 + code2.to_s
|
|
43
|
-
year = year1
|
|
44
|
+
year = year2 || year1
|
|
44
45
|
end
|
|
45
46
|
end
|
|
46
47
|
opts[:all_parts] ||= code !~ %r{^[^\s]+\s\d+-\d+} && opts[:all_parts].nil? && code2.nil?
|
|
@@ -145,7 +146,7 @@ module RelatonIso
|
|
|
145
146
|
def isobib_results_filter(result, year, opts)
|
|
146
147
|
missed_years = []
|
|
147
148
|
hits = result.reduce!([]) do |hts, h|
|
|
148
|
-
if !year || %r{:(?<iyear>\d{4})} =~ h.hit["docRef"] && iyear == year
|
|
149
|
+
if !year || %r{:(?<iyear>\d{4})(?!.*:\d{4})} =~ h.hit["docRef"] && iyear == year
|
|
149
150
|
hts << h
|
|
150
151
|
else
|
|
151
152
|
missed_years << iyear
|
data/lib/relaton_iso/scrapper.rb
CHANGED
|
@@ -36,7 +36,7 @@ module RelatonIso
|
|
|
36
36
|
}.freeze
|
|
37
37
|
|
|
38
38
|
PUBLISHERS = {
|
|
39
|
-
"
|
|
39
|
+
"IEC" => { name: "International Electrotechnical Commission",
|
|
40
40
|
url: "www.iec.ch" },
|
|
41
41
|
"ISO" => { name: "International Organization for Standardization",
|
|
42
42
|
url: "www.iso.org" },
|
|
@@ -104,7 +104,7 @@ module RelatonIso
|
|
|
104
104
|
d = l[:path] ? get_page(l[:path])[0] : doc
|
|
105
105
|
unless d.at("//h5[@class='help-block'][.='недоступно на русском языке']")
|
|
106
106
|
s << l
|
|
107
|
-
titles
|
|
107
|
+
titles += fetch_title(d, l[:lang])
|
|
108
108
|
|
|
109
109
|
# Fetch abstracts.
|
|
110
110
|
abstract_content = d.css("div[itemprop='description'] p").text
|
|
@@ -287,12 +287,14 @@ module RelatonIso
|
|
|
287
287
|
# Fetch titles.
|
|
288
288
|
# @param doc [Nokogiri::HTML::Document]
|
|
289
289
|
# @param lang [String]
|
|
290
|
-
# @return [
|
|
290
|
+
# @return [Array<RelatonBib::TypedTitleString>]
|
|
291
291
|
def fetch_title(doc, lang)
|
|
292
292
|
content = doc.at(
|
|
293
|
-
"//nav[contains(@class,'
|
|
294
|
-
)&.text
|
|
295
|
-
|
|
293
|
+
"//nav[contains(@class,'heading-condensed')]/h2 | //nav[contains(@class,'heading-condensed')]/h3",
|
|
294
|
+
)&.text&.gsub(/\u2014/, "-")
|
|
295
|
+
return [] unless content
|
|
296
|
+
|
|
297
|
+
RelatonBib::TypedTitleString.from_string content, lang, script(lang)
|
|
296
298
|
end
|
|
297
299
|
|
|
298
300
|
# Return ISO script code.
|
|
@@ -373,14 +375,14 @@ module RelatonIso
|
|
|
373
375
|
# Fetch copyright.
|
|
374
376
|
# @param ref [String]
|
|
375
377
|
# @param doc [Nokogiri::HTML::Document]
|
|
376
|
-
# @return [Hash]
|
|
378
|
+
# @return [Array<Hash>]
|
|
377
379
|
def fetch_copyright(ref, doc)
|
|
378
380
|
owner_name = ref.match(/.*?(?=\s)/).to_s
|
|
379
381
|
from = ref.match(/(?<=:)\d{4}/).to_s
|
|
380
382
|
if from.empty?
|
|
381
383
|
from = doc.xpath("//span[@itemprop='releaseDate']").text.match(/\d{4}/).to_s
|
|
382
384
|
end
|
|
383
|
-
{ owner: { name: owner_name }, from: from }
|
|
385
|
+
[{ owner: [{ name: owner_name }], from: from }]
|
|
384
386
|
end
|
|
385
387
|
end
|
|
386
388
|
end
|
data/lib/relaton_iso/version.rb
CHANGED
data/relaton_iso.gemspec
CHANGED
|
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_development_dependency "vcr"
|
|
38
38
|
spec.add_development_dependency "webmock"
|
|
39
39
|
|
|
40
|
-
spec.add_dependency "relaton-iec", "
|
|
41
|
-
spec.add_dependency "relaton-iso-bib", "
|
|
40
|
+
spec.add_dependency "relaton-iec", "~> 1.3.0"
|
|
41
|
+
spec.add_dependency "relaton-iso-bib", "~> 1.3.0"
|
|
42
42
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-iso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.3.0
|
|
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-
|
|
11
|
+
date: 2020-08-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: byebug
|
|
@@ -154,30 +154,30 @@ dependencies:
|
|
|
154
154
|
name: relaton-iec
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
156
156
|
requirements:
|
|
157
|
-
- - "
|
|
157
|
+
- - "~>"
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 1.0
|
|
159
|
+
version: 1.3.0
|
|
160
160
|
type: :runtime
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
|
-
- - "
|
|
164
|
+
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: 1.0
|
|
166
|
+
version: 1.3.0
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
168
|
name: relaton-iso-bib
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
170
170
|
requirements:
|
|
171
|
-
- - "
|
|
171
|
+
- - "~>"
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
|
-
version: 1.0
|
|
173
|
+
version: 1.3.0
|
|
174
174
|
type: :runtime
|
|
175
175
|
prerelease: false
|
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
|
178
|
-
- - "
|
|
178
|
+
- - "~>"
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
|
-
version: 1.0
|
|
180
|
+
version: 1.3.0
|
|
181
181
|
description: 'RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
|
|
182
182
|
model'
|
|
183
183
|
email:
|