html-proofer 3.18.0 → 3.18.5

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: 010dde5e6758227f807cb7b17095b68df2d987ff4911c7c1e5f8876cff2f5bf2
4
- data.tar.gz: 7925b79c6e1431c175aab35c1181ffa8127b1051427a5810411bacfe61c1ae27
3
+ metadata.gz: e90edda0dcb30f00baa440ec7b231bf73e086e0414fe9a1a56870940e2c15aeb
4
+ data.tar.gz: 2505df1fb597aaadfa68bf0f7c8b3d9380e27a236c31582d4c91840bf5e65623
5
5
  SHA512:
6
- metadata.gz: 794d63f91e2fd22e5e5dba8a1b1032ec0c85b5fbe4e4db991f02cef6c205ac777f0dc9ea611378fe1702ee57c2fb917d4a1d95f02e10dda402df6d451d6cbd54
7
- data.tar.gz: 3bf224c6ed71160031e95d3258401a314d8a480b069a5c6c9d555a163f288d1128eac3f76decd3033b2d32d98ed89f65b37bfeef696fd475a2d2b8749aa097da
6
+ metadata.gz: c5b864da4544723801ade7b906c387f893aed338ca36f9f3ae4a4660fa69f2f60883071cb2030cf526911abe954cf81932691a96c7c8f93e5e6970a18120449a
7
+ data.tar.gz: b141806119a645c1b974028f4e4ec3ecf60d74d51d1f5575d8b2fab4a3c7e90ddd8a6f8511474bd64825d49f591630ed8e9be83c1d5676b22b0f73b42ce93e3e
@@ -45,16 +45,21 @@ class LinkCheck < ::HTMLProofer::Check
45
45
  # intentionally here because we still want valid? & missing_href? to execute
46
46
  next if @link.non_http_remote?
47
47
 
48
- if !@link.internal? && @link.remote?
48
+ if !@link.href&.start_with?('#') && !@link.internal? && @link.remote?
49
49
  check_sri(line, content) if @link.check_sri? && node.name == 'link'
50
50
  # we need to skip these for now; although the domain main be valid,
51
51
  # curl/Typheous inaccurately return 404s for some links. cc https://git.io/vyCFx
52
52
  next if @link.respond_to?(:rel) && @link.rel == 'dns-prefetch'
53
53
 
54
+ unless @link.path?
55
+ add_issue("#{@link.href} is an invalid URL", line: line, content: content)
56
+ next
57
+ end
58
+
54
59
  add_to_external_urls(@link.href || @link.src)
55
60
  next
56
61
  elsif @link.internal?
57
- if @link.exists?
62
+ if @link.exists? || @link.hash
58
63
  add_to_internal_urls(@link.href, InternalLink.new(@link, @path, line, content))
59
64
  else
60
65
  add_issue("internally linking to #{@link.href}, which does not exist", line: line, content: content)
@@ -72,10 +77,10 @@ class LinkCheck < ::HTMLProofer::Check
72
77
  return false
73
78
  end
74
79
 
75
- # verify the target hash
76
- return handle_hash(link, path, line, content) if link.hash
80
+ return true unless link.hash
77
81
 
78
- true
82
+ # verify the target hash
83
+ handle_hash(link, path, line, content)
79
84
  end
80
85
 
81
86
  def check_schemes(link, line, content)
@@ -74,6 +74,10 @@ module HTMLProofer
74
74
  !parts.nil?
75
75
  end
76
76
 
77
+ def path?
78
+ !parts.host.nil? && !parts.path.nil?
79
+ end
80
+
77
81
  def parts
78
82
  @parts ||= Addressable::URI.parse url
79
83
  rescue URI::Error, Addressable::URI::InvalidURIError
@@ -157,11 +157,12 @@ module HTMLProofer
157
157
  @cache.write
158
158
  else
159
159
  @internal_urls.values.flatten.each do |internal_url|
160
- @internal_link_checks.check_internal_link(internal_url.link, internal_url.path, internal_url.line, internal_url.content)
160
+ result = @internal_link_checks.check_internal_link(internal_url.link, internal_url.path, internal_url.line, internal_url.content)
161
+ next if result
162
+
163
+ @failures.concat(@internal_link_checks.issues) unless @internal_link_checks.issues.length.zero?
161
164
  end
162
165
  end
163
-
164
- @failures.concat(@internal_link_checks.issues) unless @internal_urls.length.zero?
165
166
  end
166
167
 
167
168
  def files
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTMLProofer
4
- VERSION = '3.18.0'
4
+ VERSION = '3.18.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-proofer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.18.0
4
+ version: 3.18.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-11 00:00:00.000000000 Z
11
+ date: 2021-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -285,9 +285,12 @@ require_paths:
285
285
  - lib
286
286
  required_ruby_version: !ruby/object:Gem::Requirement
287
287
  requirements:
288
- - - "~>"
288
+ - - ">="
289
+ - !ruby/object:Gem::Version
290
+ version: 2.4.10
291
+ - - "<"
289
292
  - !ruby/object:Gem::Version
290
- version: '2.4'
293
+ version: '4.0'
291
294
  required_rubygems_version: !ruby/object:Gem::Requirement
292
295
  requirements:
293
296
  - - ">="