html-proofer 5.2.0 → 5.2.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1081048f56ee5d0b41f5ba9278d0757d1a1eef6fdb8c50148eb2b47a183b5572
|
|
4
|
+
data.tar.gz: 9a60b977a473c77c12085062b0438eb175751a0a013206ec4dbd1baf03deffb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0402cc78e35cd4440bf95e9a9d0372f68677d28ad0e901867457c4583caebb4cbd4eefdc50e27e270d85e756ee402c0e2ba6898c3bf1b074fef6f69f8b30ae7a
|
|
7
|
+
data.tar.gz: f5754b9c79336f792cb2064baab958b7c27e62d13a6ae225a9fe5cde286d773e9427251ccd7b44afa7d258e517a5838af5ad6fdff3c63a0b6bf21b8cba08c75f
|
|
@@ -172,7 +172,9 @@ module HTMLProofer
|
|
|
172
172
|
def unslashed_directory?(file)
|
|
173
173
|
return false unless File.directory?(file)
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
# the trailing slash must be read off the URL, not off `file`: the latter
|
|
176
|
+
# is produced by File.expand_path, which strips trailing separators
|
|
177
|
+
!path.to_s.end_with?("/") && !follow_location?
|
|
176
178
|
end
|
|
177
179
|
|
|
178
180
|
def follow_location?
|
|
@@ -239,7 +241,7 @@ module HTMLProofer
|
|
|
239
241
|
else
|
|
240
242
|
url
|
|
241
243
|
end
|
|
242
|
-
rescue Addressable::URI::InvalidURIError #
|
|
244
|
+
rescue Addressable::URI::InvalidURIError # -- error will be reported at check time
|
|
243
245
|
end
|
|
244
246
|
|
|
245
247
|
private def swap_urls!
|
data/lib/html_proofer/runner.rb
CHANGED
|
@@ -121,7 +121,10 @@ module HTMLProofer
|
|
|
121
121
|
return false unless url.hash?
|
|
122
122
|
|
|
123
123
|
hash = url.hash
|
|
124
|
-
headers
|
|
124
|
+
# `response.headers` covers both live responses (which expose the headers
|
|
125
|
+
# via :response_headers) and stubbed ones (which set :headers directly);
|
|
126
|
+
# reading options[:headers] saw nothing but stubs.
|
|
127
|
+
headers = response.headers || {}
|
|
125
128
|
content_type = headers.find { |k, _| k.casecmp("content-type").zero? }
|
|
126
129
|
|
|
127
130
|
# attempt to verify PDF hash ref; see #787 for more details
|
|
@@ -116,10 +116,13 @@ module HTMLProofer
|
|
|
116
116
|
return true if blank?(href_hash)
|
|
117
117
|
return true unless @runner.options[:check_internal_hash]
|
|
118
118
|
|
|
119
|
-
#
|
|
120
|
-
|
|
119
|
+
# For hash links, we need to defer to file-based checking
|
|
120
|
+
# (even if URL doesn't have extension, it may resolve to index.html)
|
|
121
121
|
return false unless url.has_hash?
|
|
122
122
|
|
|
123
|
+
# If URL has no known extension, defer to file-based checking
|
|
124
|
+
return false unless url.known_extension?
|
|
125
|
+
|
|
123
126
|
decoded_href_hash = Addressable::URI.unescape(href_hash)
|
|
124
127
|
fragment_ids = [href_hash, decoded_href_hash]
|
|
125
128
|
# https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid
|
|
@@ -134,10 +137,18 @@ module HTMLProofer
|
|
|
134
137
|
|
|
135
138
|
private def find_fragments(fragment_ids, html)
|
|
136
139
|
xpaths = fragment_ids.uniq.flat_map do |frag_id|
|
|
137
|
-
|
|
140
|
+
# Build XPath string argument, handling single quotes
|
|
141
|
+
if frag_id.include?("'")
|
|
142
|
+
# Use concat() to handle single quotes: concat('part1', "'", 'part2')
|
|
143
|
+
escaped_frag_id = frag_id.split("'").map { |part| "'#{part}'" }.join(", \"'\", ")
|
|
144
|
+
xpath_arg = "concat(#{escaped_frag_id})"
|
|
145
|
+
else
|
|
146
|
+
# No single quotes, just use quoted string
|
|
147
|
+
xpath_arg = "'#{frag_id}'"
|
|
148
|
+
end
|
|
138
149
|
[
|
|
139
|
-
"//*[case_sensitive_equals(@id,
|
|
140
|
-
"//*[case_sensitive_equals(@name,
|
|
150
|
+
"//*[case_sensitive_equals(@id, #{xpath_arg})]",
|
|
151
|
+
"//*[case_sensitive_equals(@name, #{xpath_arg})]",
|
|
141
152
|
]
|
|
142
153
|
end
|
|
143
154
|
xpaths << XpathFunctions.new
|
data/lib/html_proofer/version.rb
CHANGED
data/lib/html_proofer.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: html-proofer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.2.
|
|
4
|
+
version: 5.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Garen Torikian
|
|
@@ -135,48 +135,6 @@ dependencies:
|
|
|
135
135
|
- - "~>"
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
137
|
version: '2.5'
|
|
138
|
-
- !ruby/object:Gem::Dependency
|
|
139
|
-
name: rspec
|
|
140
|
-
requirement: !ruby/object:Gem::Requirement
|
|
141
|
-
requirements:
|
|
142
|
-
- - "~>"
|
|
143
|
-
- !ruby/object:Gem::Version
|
|
144
|
-
version: '3.1'
|
|
145
|
-
type: :development
|
|
146
|
-
prerelease: false
|
|
147
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
-
requirements:
|
|
149
|
-
- - "~>"
|
|
150
|
-
- !ruby/object:Gem::Version
|
|
151
|
-
version: '3.1'
|
|
152
|
-
- !ruby/object:Gem::Dependency
|
|
153
|
-
name: timecop
|
|
154
|
-
requirement: !ruby/object:Gem::Requirement
|
|
155
|
-
requirements:
|
|
156
|
-
- - "~>"
|
|
157
|
-
- !ruby/object:Gem::Version
|
|
158
|
-
version: '0.8'
|
|
159
|
-
type: :development
|
|
160
|
-
prerelease: false
|
|
161
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
162
|
-
requirements:
|
|
163
|
-
- - "~>"
|
|
164
|
-
- !ruby/object:Gem::Version
|
|
165
|
-
version: '0.8'
|
|
166
|
-
- !ruby/object:Gem::Dependency
|
|
167
|
-
name: vcr
|
|
168
|
-
requirement: !ruby/object:Gem::Requirement
|
|
169
|
-
requirements:
|
|
170
|
-
- - "~>"
|
|
171
|
-
- !ruby/object:Gem::Version
|
|
172
|
-
version: '6.4'
|
|
173
|
-
type: :development
|
|
174
|
-
prerelease: false
|
|
175
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
176
|
-
requirements:
|
|
177
|
-
- - "~>"
|
|
178
|
-
- !ruby/object:Gem::Version
|
|
179
|
-
version: '6.4'
|
|
180
138
|
description: Test your rendered HTML files to make sure they're accurate.
|
|
181
139
|
email:
|
|
182
140
|
- gjtorikian@gmail.com
|
|
@@ -234,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
234
192
|
- !ruby/object:Gem::Version
|
|
235
193
|
version: '0'
|
|
236
194
|
requirements: []
|
|
237
|
-
rubygems_version: 4.0.
|
|
195
|
+
rubygems_version: 4.0.10
|
|
238
196
|
specification_version: 4
|
|
239
197
|
summary: A set of tests to validate your HTML output. These tests check if your image
|
|
240
198
|
references are legitimate, if they have alt tags, if your internal links are working,
|