readability-rb 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7c8a5adc3a628af9f665a4a90129612b5be891797f0b90681ed96be5566a9fb
4
- data.tar.gz: 76eb683b6a38605b637cbcbda8c25b96ef3060f7f8d277acfd3f4885537a6708
3
+ metadata.gz: ef0802d2a5e51416ef279914f65666a671217644df050a35b437e8a40046c8de
4
+ data.tar.gz: fe5be59a935e77a94af0b1243a7b2c5457eccbfaaf18452f18a7debf4a7b0560
5
5
  SHA512:
6
- metadata.gz: 94f81c5b0502338b55ed611a6c289dfbd8250b1c058df5b45dff87bd126bcff2038518e85da4dfff0f6baea366f4cdb76305e258936862d063e1f964e621e1bf
7
- data.tar.gz: ae056bc80680ad1416829e7454f0045c49ac7978450269ea2a5ee29955a7b84a11511100fe4ae2283abba835d4449be3fc22caf037e51fb9cfad4580cc61b5ef
6
+ metadata.gz: '0269968c8945402342b91435868227b09301303ecbffe12ee499161dc0accb231d576cef67c84e434a382dbea1895fc7a520a28c8068ba4a25b5108704f7b480'
7
+ data.tar.gz: 5b6a4b7647248c90a40f5316d8a9b498164e6510209c653751664470a2af8d0b9900651a3a5e37be6f3c36b15320f92684044e0279a42363f145e744c34f0dd5
@@ -41,7 +41,7 @@ module Readability
41
41
 
42
42
  if parsed.is_a?(Array)
43
43
  parsed = parsed.find do |it|
44
- it["@type"] && it["@type"].match?(JSON_LD_ARTICLE_TYPES)
44
+ Array(it["@type"]).any? { |t| t.match?(JSON_LD_ARTICLE_TYPES) }
45
45
  end
46
46
  next unless parsed
47
47
  end
@@ -58,11 +58,13 @@ module Readability
58
58
 
59
59
  if !parsed["@type"] && parsed["@graph"].is_a?(Array)
60
60
  parsed = parsed["@graph"].find do |it|
61
- (it["@type"] || "").match?(JSON_LD_ARTICLE_TYPES)
61
+ next unless it.is_a?(Hash)
62
+
63
+ Array(it["@type"]).any? { |t| t.is_a?(String) && t.match?(JSON_LD_ARTICLE_TYPES) }
62
64
  end
63
65
  end
64
66
 
65
- next if !parsed || !parsed["@type"] || !parsed["@type"].match?(JSON_LD_ARTICLE_TYPES)
67
+ next if !parsed || !parsed["@type"] || !Array(parsed["@type"]).any? { |t| t.is_a?(String) && t.match?(JSON_LD_ARTICLE_TYPES) }
66
68
 
67
69
  metadata = {}
68
70
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Readability
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readability-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Croll
@@ -49,7 +49,7 @@ licenses:
49
49
  metadata:
50
50
  homepage_uri: https://github.com/andycroll/readability-rb
51
51
  source_code_uri: https://github.com/andycroll/readability-rb
52
- changelog_uri: https://github.com/andycroll/readability-rb/commits/main
52
+ changelog_uri: https://github.com/andycroll/readability-rb/blob/main/CHANGELOG.md
53
53
  bug_tracker_uri: https://github.com/andycroll/readability-rb/issues
54
54
  rdoc_options: []
55
55
  require_paths: