relaton-iso 1.18.3 → 1.18.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton_iso/scrapper.rb +10 -8
- data/lib/relaton_iso/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: 9d84323d65b954dcb15e73fb00917f6420494f11f1dfb5dbb5bf59e8fcae15ef
|
4
|
+
data.tar.gz: f9b9364c9804f46af7ad56d2b1c708a3e98760c9948142686f5ace87807a628c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b242baf862c63b243d6a4c41611cc9e6f900cc269e78ed80c36d8e44fabad7a2f2ae6abcf72b8661c65467e52193c4b922d7d15b6cf82c187f5620f5264135cc
|
7
|
+
data.tar.gz: fb95d361df7ed56a0c6b33cc2239a2445f44e7a41f8f217f41a7b337629a3021efe59a11a6686f951fbf79f8fec747dc741978308b1a800c94601f8d0061be36
|
data/lib/relaton_iso/scrapper.rb
CHANGED
@@ -56,7 +56,7 @@ module RelatonIso
|
|
56
56
|
# @return [RelatonIsoBib::IsoBibliographicItem]
|
57
57
|
def parse_page(path, lang = nil) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
58
58
|
doc, url = get_page path
|
59
|
-
id = doc.at("//
|
59
|
+
id = doc.at("//h1/span[1]").text.split(" | ").first.strip
|
60
60
|
pubid = Pubid::Iso::Identifier.parse(id)
|
61
61
|
# Fetch edition.
|
62
62
|
edition = doc.at("//div[div[.='Edition']]/text()[last()]")&.text&.match(/\d+$/)&.to_s
|
@@ -279,7 +279,7 @@ module RelatonIso
|
|
279
279
|
# @return [String, nil] ID
|
280
280
|
#
|
281
281
|
def item_ref(doc)
|
282
|
-
doc.at("//main//section/div/div/div//h1")&.text
|
282
|
+
doc.at("//main//section/div/div/div//h1/span[1]")&.text
|
283
283
|
end
|
284
284
|
|
285
285
|
# Fetch status.
|
@@ -327,7 +327,9 @@ module RelatonIso
|
|
327
327
|
# @return [Array<Hash>]
|
328
328
|
def fetch_relations(doc)
|
329
329
|
types = ["Now", "Now under review"]
|
330
|
-
doc.xpath(
|
330
|
+
doc.xpath(
|
331
|
+
"//ul[@class='steps']/li", "//div[contains(@class, 'sub-step')]"
|
332
|
+
).reduce([]) do |a, r|
|
331
333
|
type, date = relation_type(r.at("h4", "h5").text.strip, doc)
|
332
334
|
next a if types.include?(type)
|
333
335
|
|
@@ -347,7 +349,7 @@ module RelatonIso
|
|
347
349
|
date = []
|
348
350
|
t = case type.strip
|
349
351
|
when "Previously", "Will be replaced by" then "obsoletes"
|
350
|
-
when
|
352
|
+
when /Corrigenda|Amendments|Revised by|Now confirmed|replaced by/
|
351
353
|
on = doc.xpath('//span[@class="stage-date"][contains(., "-")]').last
|
352
354
|
date << { type: "circulated", on: on.text } if on
|
353
355
|
"updates"
|
@@ -411,9 +413,9 @@ module RelatonIso
|
|
411
413
|
end
|
412
414
|
|
413
415
|
def titles(doc)
|
414
|
-
head = doc.at "//nav[contains(@class,'heading-condensed')]"
|
415
|
-
ttls =
|
416
|
-
ttls = ttls[0].split
|
416
|
+
# head = doc.at "//nav[contains(@class,'heading-condensed')]"
|
417
|
+
ttls = doc.xpath("//h1[@class='stdTitle']/span[position()>1]").map(&:text)
|
418
|
+
ttls[0, 1] = ttls[0].split(/\s(?:-|\u2014)\s/) # if ttls.size == 1
|
417
419
|
case ttls.size
|
418
420
|
when 0, 1 then [nil, ttls.first, nil]
|
419
421
|
else RelatonBib::TypedTitleString.intro_or_part ttls
|
@@ -489,7 +491,7 @@ module RelatonIso
|
|
489
491
|
#
|
490
492
|
def fetch_link(doc, url)
|
491
493
|
links = [{ type: "src", content: url }]
|
492
|
-
obp = doc.at("//
|
494
|
+
obp = doc.at("//a[.='Read sample']")
|
493
495
|
links << { type: "obp", content: obp[:href] } if obp
|
494
496
|
rss = doc.at("//a[contains(@href, 'rss')]")
|
495
497
|
links << { type: "rss", content: DOMAIN + rss[:href] } if rss
|
data/lib/relaton_iso/version.rb
CHANGED
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.18.
|
4
|
+
version: 1.18.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pubid
|