relaton-w3c 1.3.1 → 1.3.2
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 -2
- data/lib/relaton_w3c/scrapper.rb +8 -0
- 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: d7dd4430200f1bc42ef19c5e7efd4eb0bee2167d17c80ca44533f0b08e6bdfe6
|
4
|
+
data.tar.gz: 62b4b98f90f7541d8099647f287e94cbe62600ef5943bcd7e315b7d8990f8424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5480d5eb9a41ef48c7e4a9237f793e96016c32ed3b1cd982b784f4e3e8f0ba84de136b13993ef7a5d6d2fda92540cf5be98339fd198bc93e5486e572958a5feb
|
7
|
+
data.tar.gz: 12de49efbd61c4417ba7d31062f63560883cbe46f5ca9405218e84cb7d815f2717ea691cfd83175aff5b072cc44f7c3284fea526991d9395e9c47789d283b593
|
@@ -45,7 +45,9 @@ module RelatonW3c
|
|
45
45
|
/(?<title>.+)\s(?<date>\d{4}-\d{2}-\d{2})$/ =~ title_date
|
46
46
|
title ||= title_date
|
47
47
|
result = data.select do |hit|
|
48
|
-
hit["title"]
|
48
|
+
(hit["title"].casecmp?(title) ||
|
49
|
+
hit["link"].split("/").last.match?(/#{title}/)) &&
|
50
|
+
type_date_filter(hit, type, date)
|
49
51
|
end
|
50
52
|
result.map { |h| Hit.new(h, self) }
|
51
53
|
end
|
@@ -54,7 +56,7 @@ module RelatonW3c
|
|
54
56
|
# @param type [String]
|
55
57
|
# @param date [String]
|
56
58
|
# @return [TrueClass, FalseClass]
|
57
|
-
def type_date_filter(hit, type, date)
|
59
|
+
def type_date_filter(hit, type, date) # rubocop:disable Metrics/AbcSize
|
58
60
|
if type && hit["type"] != short_type(type) || date && hit["date"] != date
|
59
61
|
history = get_history hit, type, date
|
60
62
|
return false unless history.any?
|
data/lib/relaton_w3c/scrapper.rb
CHANGED
@@ -18,6 +18,7 @@ module RelatonW3c
|
|
18
18
|
doc = resp.code == "200" ? Nokogiri::HTML(resp.body) : nil
|
19
19
|
W3cBibliographicItem.new(
|
20
20
|
type: "standard",
|
21
|
+
docid: fetch_docid(hit),
|
21
22
|
fetched: Date.today.to_s,
|
22
23
|
language: ["en"],
|
23
24
|
script: ["Latn"],
|
@@ -34,6 +35,13 @@ module RelatonW3c
|
|
34
35
|
|
35
36
|
private
|
36
37
|
|
38
|
+
# @param hit [Hash]
|
39
|
+
# @return [Array<RelatonBib::DocumentIdentifier>]
|
40
|
+
def fetch_docid(hit)
|
41
|
+
id = hit["link"].split("/").last
|
42
|
+
[RelatonBib::DocumentIdentifier.new(id: id, type: "W3C")]
|
43
|
+
end
|
44
|
+
|
37
45
|
# @param hit [Hash]
|
38
46
|
# @param doc [Nokogiri::HTML::Document]
|
39
47
|
# @return [Array<RelatonBib::TypedTitleString>]
|
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.2
|
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-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|