relaton-w3c 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton_w3c/hit_collection.rb +4 -1
- data/lib/relaton_w3c/scrapper.rb +4 -3
- data/lib/relaton_w3c/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: 42a40987b4156671fee680b2ef9eb9a6b42f5a356f62c09d7f56eaf9ae466578
|
4
|
+
data.tar.gz: dcd2de5ae0c8582a2dc3fb29473faee5367c81cf48a394f6cf09b45134c66e0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b94a6b93e792f44145b7b70139c673e534addc6989272c623ccfd3a1828b3376755f7193ca9dbcf35049f169a9c0084c3e8111977653ccb62fb5e8d7a2a18c9b
|
7
|
+
data.tar.gz: 272f89a76aeceacd9db2366cd80a0316023c3594a9fc058bed048b883ecea0dd07e63769e14988da0ea6506581ebd0d76539ee4097750bab5ee9ea5b415f6b24
|
@@ -46,9 +46,12 @@ module RelatonW3c
|
|
46
46
|
title ||= title_date
|
47
47
|
result = data.select do |hit|
|
48
48
|
(hit["title"].casecmp?(title) ||
|
49
|
-
hit["link"].split("/").last.match?(
|
49
|
+
hit["link"].split("/").last.match?(/-#{title}-/)) &&
|
50
50
|
type_date_filter(hit, type, date)
|
51
51
|
end
|
52
|
+
if result.empty?
|
53
|
+
result = data.select { |h| h["link"].split("/").last.match? /#{title}/ }
|
54
|
+
end
|
52
55
|
result.map { |h| Hit.new(h, self) }
|
53
56
|
end
|
54
57
|
|
data/lib/relaton_w3c/scrapper.rb
CHANGED
@@ -48,13 +48,14 @@ module RelatonW3c
|
|
48
48
|
def fetch_title(hit, doc) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
49
49
|
titles = []
|
50
50
|
if doc
|
51
|
-
title = doc.at("
|
52
|
-
titles << { content: title, type: "main" } if title
|
51
|
+
title = doc.at("//*[contains(@id, 'title')]")&.text
|
52
|
+
titles << { content: title, type: "main" } if title && !title.empty?
|
53
53
|
subtitle = doc.at(
|
54
54
|
"//h2[@id='subtitle']|//p[contains(@class, 'subline')]"
|
55
55
|
)&.text
|
56
56
|
titles << { content: subtitle, tipe: "subtitle" } if subtitle
|
57
|
-
|
57
|
+
end
|
58
|
+
if titles.empty? && hit["title"]
|
58
59
|
titles << { content: hit["title"], type: "main" }
|
59
60
|
end
|
60
61
|
titles.map do |t|
|
data/lib/relaton_w3c/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-w3c
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.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-09-
|
11
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|