html-proofer 3.3.1 → 3.4.0

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
  SHA1:
3
- metadata.gz: 1362c6dbcda2e6b32a8794d8059a2faed3d53220
4
- data.tar.gz: 367c4016f9c5f916f296a1aa0db2ddf7b4504212
3
+ metadata.gz: dbcb9a266ebfc0ded83c471ce4c39b316707cdc8
4
+ data.tar.gz: 95eaa7fb30840606d11dc234eb9b6e5917971100
5
5
  SHA512:
6
- metadata.gz: 40257c5bfc71ebcdb65215d1a4e1c18009453c8d16115b8555d262e985e57ff7801e6425c0af087247ab7efa7dbd65391476e3cf7375b570d4989da981085966
7
- data.tar.gz: 0f673f255d4641a3e8c61943729b9fcd76c36e2b0f03201abbff81fdf961ceb9ead4ea618149e4d8e72db24c5bb991bc34cc3b7b04ffdfe0b7537607e65dc6fa
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
- unless hash_check @html, link.hash
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
@@ -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
- url.start_with? '#', '?'
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(href, filenames, response_code, response.return_message)
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
@@ -1,3 +1,3 @@
1
1
  module HTMLProofer
2
- VERSION = '3.3.1'.freeze
2
+ VERSION = '3.4.0'.freeze
3
3
  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.3.1
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-10-20 00:00:00.000000000 Z
11
+ date: 2016-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mercenary