html-proofer 3.3.1 → 3.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 +4 -4
- data/lib/html-proofer/check/links.rb +3 -5
- data/lib/html-proofer/element.rb +28 -2
- data/lib/html-proofer/url_validator.rb +1 -1
- data/lib/html-proofer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbcb9a266ebfc0ded83c471ce4c39b316707cdc8
|
4
|
+
data.tar.gz: 95eaa7fb30840606d11dc234eb9b6e5917971100
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91e54490b69b026d0e2ddefbdc6a89858c6943b3193a2f80b389835f45d10708f5b9abb919c3eece6a6827b0630afc67f2d1d49b0c60c5a669fcdf6ecfdac444
|
7
|
+
data.tar.gz: a97d14e881323aa66e7a7c31bd1db5f007890d3715ba0950a9bf51f44117f076e982cc7c85a0b1e9433f5c4dfd5d5ecb12212b5d92108d4c21c7e4e3bbdc885e
|
@@ -39,7 +39,7 @@ class LinkCheck < ::HTMLProofer::Check
|
|
39
39
|
# intentionally here because we still want valid? & missing_href? to execute
|
40
40
|
next if @link.non_http_remote?
|
41
41
|
# does the file even exist?
|
42
|
-
if @link.remote?
|
42
|
+
if !@link.internal? && @link.remote?
|
43
43
|
add_to_external_urls(@link.href)
|
44
44
|
next
|
45
45
|
elsif !@link.internal? && !@link.exists?
|
@@ -84,10 +84,8 @@ class LinkCheck < ::HTMLProofer::Check
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def handle_hash(link, line, content)
|
87
|
-
if link.internal?
|
88
|
-
|
89
|
-
add_issue("linking to internal hash ##{link.hash} that does not exist", line: line, content: content)
|
90
|
-
end
|
87
|
+
if link.internal? && !hash_check(link.html, link.hash)
|
88
|
+
add_issue("linking to internal hash ##{link.hash} that does not exist", line: line, content: content)
|
91
89
|
elsif link.external?
|
92
90
|
external_link_check(link, line, content)
|
93
91
|
end
|
data/lib/html-proofer/element.rb
CHANGED
@@ -16,6 +16,8 @@ module HTMLProofer
|
|
16
16
|
instance_variable_set("@#{name}", value.value)
|
17
17
|
end
|
18
18
|
|
19
|
+
@aria_hidden = @aria_hidden == "true" ? true : false
|
20
|
+
|
19
21
|
@text = obj.content
|
20
22
|
@check = check
|
21
23
|
@checked_paths = {}
|
@@ -86,7 +88,7 @@ module HTMLProofer
|
|
86
88
|
end
|
87
89
|
|
88
90
|
def ignore_alt?
|
89
|
-
return true if ignores_pattern_check(@check.options[:alt_ignore])
|
91
|
+
return true if ignores_pattern_check(@check.options[:alt_ignore]) || @aria_hidden
|
90
92
|
end
|
91
93
|
|
92
94
|
def ignore_empty_alt?
|
@@ -108,7 +110,19 @@ module HTMLProofer
|
|
108
110
|
|
109
111
|
# path is an anchor or a query
|
110
112
|
def internal?
|
111
|
-
|
113
|
+
hash_link || param_link || slash_link
|
114
|
+
end
|
115
|
+
|
116
|
+
def hash_link
|
117
|
+
url.start_with?('#')
|
118
|
+
end
|
119
|
+
|
120
|
+
def param_link
|
121
|
+
url.start_with?('?')
|
122
|
+
end
|
123
|
+
|
124
|
+
def slash_link
|
125
|
+
url.start_with?('|')
|
112
126
|
end
|
113
127
|
|
114
128
|
def file_path
|
@@ -176,5 +190,17 @@ module HTMLProofer
|
|
176
190
|
def base
|
177
191
|
@base ||= @html.at_css('base')
|
178
192
|
end
|
193
|
+
|
194
|
+
def html
|
195
|
+
if internal?
|
196
|
+
# If link is on the same page, then URL is on the current page so can use the same HTML as for current page
|
197
|
+
if hash_link || param_link
|
198
|
+
@html
|
199
|
+
elsif slash_link
|
200
|
+
# link on another page, e.g. /about#Team - need to get HTML from the other page
|
201
|
+
create_nokogiri(absolute_path)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
179
205
|
end
|
180
206
|
end
|
@@ -150,7 +150,7 @@ module HTMLProofer
|
|
150
150
|
elsif response.timed_out?
|
151
151
|
handle_timeout(href, filenames, response_code)
|
152
152
|
elsif response_code == 0
|
153
|
-
handle_failure(
|
153
|
+
handle_failure(effective_url, filenames, response_code, response.return_message)
|
154
154
|
elsif method == :head
|
155
155
|
queue_request(:get, href, filenames)
|
156
156
|
else
|
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.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|