html-proofer 3.18.1 → 3.18.6
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 +4 -4
- data/lib/html-proofer/cache.rb +6 -1
- data/lib/html-proofer/check/links.rb +10 -8
- data/lib/html-proofer/element.rb +7 -1
- data/lib/html-proofer/middleware.rb +1 -1
- data/lib/html-proofer/runner.rb +8 -5
- data/lib/html-proofer/url_validator.rb +1 -1
- data/lib/html-proofer/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2d6deb85601ff3f5e5df02999f1b55f29231e5658f1d4fa9986c002b3cc0263
|
4
|
+
data.tar.gz: e20a007144a866b41b97eb36a964ca1372d693ade77acc69a9c9e706b353c8ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c51154450eb20c04c0b7038effb12ab8d258457ea5560421b5a2a0739342504afebb8fd092fe4378838a076636ff2665eb691f513b8b34b49af2e89ffba988c2
|
7
|
+
data.tar.gz: fcb7bf492588fabc991caf1f779fca14a7b553d3ce00dbf55ba24aebf3c39f7613af6a408d94c3a3faaeb21dceb8265ece91ca9bf4320aee7d4f3dca133ba4de
|
data/lib/html-proofer/cache.rb
CHANGED
@@ -109,8 +109,13 @@ module HTMLProofer
|
|
109
109
|
additions
|
110
110
|
end
|
111
111
|
|
112
|
+
# TODO: Garbage performance--both the external and internal
|
113
|
+
# caches need access to this file. Write a proper versioned
|
114
|
+
# schema in the future
|
112
115
|
def write
|
113
|
-
|
116
|
+
file = {}
|
117
|
+
file = JSON.parse(File.read(cache_file)) if File.exist?(cache_file)
|
118
|
+
File.write(cache_file, file.merge(@cache_log).to_json)
|
114
119
|
end
|
115
120
|
|
116
121
|
def load?
|
@@ -51,14 +51,16 @@ class LinkCheck < ::HTMLProofer::Check
|
|
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
|
-
|
58
|
-
|
59
|
-
else
|
60
|
-
add_issue("internally linking to #{@link.href}, which does not exist", line: line, content: content)
|
61
|
-
end
|
62
|
+
add_to_internal_urls(@link.href, InternalLink.new(@link, @path, line, content))
|
63
|
+
add_issue("internally linking to #{@link.href}, which does not exist", line: line, content: content) if !@link.exists? && !@link.hash
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
@@ -72,10 +74,10 @@ class LinkCheck < ::HTMLProofer::Check
|
|
72
74
|
return false
|
73
75
|
end
|
74
76
|
|
75
|
-
|
76
|
-
return handle_hash(link, path, line, content) if link.hash
|
77
|
+
return true unless link.hash
|
77
78
|
|
78
|
-
|
79
|
+
# verify the target hash
|
80
|
+
handle_hash(link, path, line, content)
|
79
81
|
end
|
80
82
|
|
81
83
|
def check_schemes(link, line, content)
|
data/lib/html-proofer/element.rb
CHANGED
@@ -24,7 +24,7 @@ module HTMLProofer
|
|
24
24
|
raise e
|
25
25
|
end
|
26
26
|
|
27
|
-
@aria_hidden = defined?(@aria_hidden) && @aria_hidden == 'true'
|
27
|
+
@aria_hidden = defined?(@aria_hidden) && @aria_hidden == 'true'
|
28
28
|
|
29
29
|
@data_proofer_ignore = defined?(@data_proofer_ignore)
|
30
30
|
|
@@ -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
|
@@ -216,6 +220,8 @@ module HTMLProofer
|
|
216
220
|
end
|
217
221
|
|
218
222
|
def ignores_pattern_check(links)
|
223
|
+
return false unless links.is_a?(Array)
|
224
|
+
|
219
225
|
links.each do |ignore|
|
220
226
|
case ignore
|
221
227
|
when String
|
@@ -22,7 +22,7 @@ module HTMLProofer
|
|
22
22
|
allow_hash_href: true,
|
23
23
|
check_external_hash: true,
|
24
24
|
check_html: true,
|
25
|
-
url_ignore: [
|
25
|
+
url_ignore: [%r{^/}], # Don't try to check if local files exist
|
26
26
|
validation: { report_eof_tags: true }
|
27
27
|
}
|
28
28
|
end
|
data/lib/html-proofer/runner.rb
CHANGED
@@ -63,7 +63,9 @@ module HTMLProofer
|
|
63
63
|
swap(url, @options[:url_swap])
|
64
64
|
end
|
65
65
|
end
|
66
|
-
@external_urls =
|
66
|
+
@external_urls = @src.each_with_object({}) do |url, hash|
|
67
|
+
hash[url] = nil
|
68
|
+
end
|
67
69
|
validate_external_urls
|
68
70
|
end
|
69
71
|
|
@@ -123,7 +125,7 @@ module HTMLProofer
|
|
123
125
|
end
|
124
126
|
|
125
127
|
external_urls = check.external_urls
|
126
|
-
external_urls =
|
128
|
+
external_urls = check.external_urls.map { |url, file| [swap(url, @options[:url_swap]), file] }.to_h if @options[:url_swap]
|
127
129
|
result[:external_urls].merge!(external_urls)
|
128
130
|
result[:failures].concat(check.issues)
|
129
131
|
end
|
@@ -157,11 +159,12 @@ module HTMLProofer
|
|
157
159
|
@cache.write
|
158
160
|
else
|
159
161
|
@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)
|
162
|
+
result = @internal_link_checks.check_internal_link(internal_url.link, internal_url.path, internal_url.line, internal_url.content)
|
163
|
+
next if result
|
164
|
+
|
165
|
+
@failures.concat(@internal_link_checks.issues) unless @internal_link_checks.issues.length.zero?
|
161
166
|
end
|
162
167
|
end
|
163
|
-
|
164
|
-
@failures.concat(@internal_link_checks.issues) unless @internal_urls.length.zero?
|
165
168
|
end
|
166
169
|
|
167
170
|
def files
|
@@ -85,7 +85,7 @@ module HTMLProofer
|
|
85
85
|
# for HEAD. If we've decided to check for hashes, we must do a GET--HEAD is
|
86
86
|
# not available as an option.
|
87
87
|
def external_link_checker(external_urls)
|
88
|
-
external_urls =
|
88
|
+
external_urls = external_urls.sort.to_h
|
89
89
|
|
90
90
|
count = external_urls.length
|
91
91
|
check_text = pluralize(count, 'external link', 'external links')
|
data/lib/html-proofer/version.rb
CHANGED
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.
|
4
|
+
version: 3.18.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-21 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: '
|
293
|
+
version: '4.0'
|
291
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
292
295
|
requirements:
|
293
296
|
- - ">="
|