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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8591c4405cfb771a9cf41e2c74a7d36f21f66e02776389efdf670e639818524a
4
- data.tar.gz: be0e0ea3effefd0ab0a48d72cb42eb5da6c62537deaa6dca876d3ee000cc12c6
3
+ metadata.gz: d7dd4430200f1bc42ef19c5e7efd4eb0bee2167d17c80ca44533f0b08e6bdfe6
4
+ data.tar.gz: 62b4b98f90f7541d8099647f287e94cbe62600ef5943bcd7e315b7d8990f8424
5
5
  SHA512:
6
- metadata.gz: de33be8c4b6a7d9b3ee165454f6988044f5e614239d35e5c9bfa4b8dfc724430f6366dfb90d9bd1c648c78ef1ef7a3701e4ac4461eff9d82be2e2502e588f8bf
7
- data.tar.gz: fa7c426893f99844fa702dcbd349bcc141800994e167da25657ea1d5143de442aa5be4be03242221635edf9836d4c1c678e4a522f52c964ddd50f851fdda8d4a
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"] == title && type_date_filter(hit, type, date)
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?
@@ -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>]
@@ -1,3 +1,3 @@
1
1
  module RelatonW3c
2
- VERSION = "1.3.1".freeze
2
+ VERSION = "1.3.2".freeze
3
3
  end
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.1
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-08-31 00:00:00.000000000 Z
11
+ date: 2020-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase