html-proofer 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/html-proofer.gemspec +1 -1
- data/lib/html/proofer/checks/links.rb +22 -3
- data/spec/html/proofer/fixtures/links/{folder → folder-php}/index.php +0 -0
- data/spec/html/proofer/fixtures/links/link_pointing_to_directory.html +1 -1
- data/spec/html/proofer/fixtures/links/placeholder_with_empty_id.html +1 -0
- data/spec/html/proofer/fixtures/links/placeholder_with_id.html +1 -0
- data/spec/html/proofer/fixtures/links/placeholder_with_name.html +1 -0
- data/spec/html/proofer/links_spec.rb +26 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ec0386b90eb4e6cd4488cc9c05a51f9bb4618b9
|
4
|
+
data.tar.gz: 131403625ac57dc2efbae4799f6925151457f0d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8574ae57e7f490f393d0031f054d3f00b5e2ab8a530bfa9bf4188328186c29aefc4508db03422a520febdd15149a13aadf8f5f6d5a910ae6ea6856962085c8f3
|
7
|
+
data.tar.gz: 56ebf1b4e835f97aca351f4c76eef0000198f09b555f155ba1510faf719b0c423cae7377d411478276c431342ae5854fcd77afe12952b89f4631c61e15ef8df1
|
data/html-proofer.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "html-proofer"
|
6
|
-
gem.version = "1.3.
|
6
|
+
gem.version = "1.3.3"
|
7
7
|
gem.authors = ["Garen Torikian"]
|
8
8
|
gem.email = ["gjtorikian@gmail.com"]
|
9
9
|
gem.description = %q{Test your rendered HTML files to make sure they're accurate.}
|
@@ -3,11 +3,29 @@
|
|
3
3
|
class Link < ::HTML::Proofer::Checkable
|
4
4
|
|
5
5
|
def href
|
6
|
-
|
6
|
+
real_attr @href
|
7
|
+
end
|
8
|
+
|
9
|
+
def id
|
10
|
+
real_attr @id
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
real_attr @name
|
7
15
|
end
|
8
16
|
|
9
17
|
def missing_href?
|
10
|
-
href.nil? and
|
18
|
+
href.nil? and name.nil? and id.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
def placeholder?
|
22
|
+
(id || name) && href.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def real_attr(attr)
|
28
|
+
attr unless attr.nil? || attr.empty?
|
11
29
|
end
|
12
30
|
|
13
31
|
end
|
@@ -20,6 +38,7 @@ class Links < ::HTML::Proofer::Checks::Check
|
|
20
38
|
|
21
39
|
next if link.ignore?
|
22
40
|
next if link.href =~ /^javascript:/ # can't put this in ignore? because the URI does not parse
|
41
|
+
next if link.placeholder?
|
23
42
|
|
24
43
|
# is it even a valid URL?
|
25
44
|
unless link.valid?
|
@@ -40,7 +59,7 @@ class Links < ::HTML::Proofer::Checks::Check
|
|
40
59
|
self.add_issue "internally linking to #{link.href}, which does not exist" unless link.exists?
|
41
60
|
end
|
42
61
|
|
43
|
-
#
|
62
|
+
# does the local directory have a trailing slash?
|
44
63
|
if link.unslashed_directory? link.absolute_path
|
45
64
|
self.add_issue("internally linking to a directory #{link.absolute_path} without trailing slash")
|
46
65
|
next
|
File without changes
|
@@ -1 +1 @@
|
|
1
|
-
<a href="folder/">Directory</a>
|
1
|
+
<a href="folder-php/">Directory</a>
|
@@ -0,0 +1 @@
|
|
1
|
+
<a id=""></a>
|
@@ -0,0 +1 @@
|
|
1
|
+
<a id="placeholder"></a>
|
@@ -0,0 +1 @@
|
|
1
|
+
<a name="placeholder"></a>
|
@@ -210,12 +210,19 @@ describe "Links test" do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
it "works for directory index file" do
|
213
|
-
options = { :
|
213
|
+
options = { :directory_index_file => "index.php" }
|
214
214
|
link_pointing_to_directory = "#{FIXTURES_DIR}/links/link_pointing_to_directory.html"
|
215
215
|
output = capture_stderr { HTML::Proofer.new(link_pointing_to_directory, options).run }
|
216
216
|
output.should == ""
|
217
217
|
end
|
218
218
|
|
219
|
+
it "fails if directory index file doesn't exist" do
|
220
|
+
options = { :directory_index_file => "README.md" }
|
221
|
+
link_pointing_to_directory = "#{FIXTURES_DIR}/links/link_pointing_to_directory.html"
|
222
|
+
output = capture_stderr { HTML::Proofer.new(link_pointing_to_directory, options).run }
|
223
|
+
output.should match "internally linking to folder-php/, which does not exist"
|
224
|
+
end
|
225
|
+
|
219
226
|
it "ensures Typhoeus options are passed" do
|
220
227
|
options = { ssl_verifypeer: false }
|
221
228
|
typhoeus_options_link = "#{FIXTURES_DIR}/links/ensure_typhoeus_options.html"
|
@@ -234,4 +241,22 @@ describe "Links test" do
|
|
234
241
|
output = capture_stderr { HTML::Proofer.new(hashReferringToSelf).run }
|
235
242
|
output.should == ""
|
236
243
|
end
|
244
|
+
|
245
|
+
it "ignores placeholder with name" do
|
246
|
+
placeholder_with_name = "#{FIXTURES_DIR}/links/placeholder_with_name.html"
|
247
|
+
output = capture_stderr { HTML::Proofer.new(placeholder_with_name).run }
|
248
|
+
output.should == ""
|
249
|
+
end
|
250
|
+
|
251
|
+
it "ignores placeholder with id" do
|
252
|
+
placeholder_with_id = "#{FIXTURES_DIR}/links/placeholder_with_id.html"
|
253
|
+
output = capture_stderr { HTML::Proofer.new(placeholder_with_id).run }
|
254
|
+
output.should == ""
|
255
|
+
end
|
256
|
+
|
257
|
+
it "fails for placeholder with empty id" do
|
258
|
+
empty_id = "#{FIXTURES_DIR}/links/placeholder_with_empty_id.html"
|
259
|
+
output = capture_stderr { HTML::Proofer.new(empty_id).run }
|
260
|
+
output.should match /anchor has no href attribute/
|
261
|
+
end
|
237
262
|
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: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|
@@ -198,10 +198,10 @@ files:
|
|
198
198
|
- spec/html/proofer/fixtures/links/checkSSLLinks.html
|
199
199
|
- spec/html/proofer/fixtures/links/ensure_typhoeus_options.html
|
200
200
|
- spec/html/proofer/fixtures/links/escape_pipes.html
|
201
|
+
- spec/html/proofer/fixtures/links/folder-php/index.php
|
201
202
|
- spec/html/proofer/fixtures/links/folder/anchorLink.html
|
202
203
|
- spec/html/proofer/fixtures/links/folder/assets/barrel.png
|
203
204
|
- spec/html/proofer/fixtures/links/folder/index.html
|
204
|
-
- spec/html/proofer/fixtures/links/folder/index.php
|
205
205
|
- spec/html/proofer/fixtures/links/folder/relativeImage.html
|
206
206
|
- spec/html/proofer/fixtures/links/gpl.png
|
207
207
|
- spec/html/proofer/fixtures/links/hashReferringToSelf.html
|
@@ -224,6 +224,9 @@ files:
|
|
224
224
|
- spec/html/proofer/fixtures/links/missingLinkHref.html
|
225
225
|
- spec/html/proofer/fixtures/links/multipleProblems.html
|
226
226
|
- spec/html/proofer/fixtures/links/notarealhash.html
|
227
|
+
- spec/html/proofer/fixtures/links/placeholder_with_empty_id.html
|
228
|
+
- spec/html/proofer/fixtures/links/placeholder_with_id.html
|
229
|
+
- spec/html/proofer/fixtures/links/placeholder_with_name.html
|
227
230
|
- spec/html/proofer/fixtures/links/relativeLinks.html
|
228
231
|
- spec/html/proofer/fixtures/links/rootLink/folder/index.html
|
229
232
|
- spec/html/proofer/fixtures/links/rootLink/index.html
|
@@ -311,10 +314,10 @@ test_files:
|
|
311
314
|
- spec/html/proofer/fixtures/links/checkSSLLinks.html
|
312
315
|
- spec/html/proofer/fixtures/links/ensure_typhoeus_options.html
|
313
316
|
- spec/html/proofer/fixtures/links/escape_pipes.html
|
317
|
+
- spec/html/proofer/fixtures/links/folder-php/index.php
|
314
318
|
- spec/html/proofer/fixtures/links/folder/anchorLink.html
|
315
319
|
- spec/html/proofer/fixtures/links/folder/assets/barrel.png
|
316
320
|
- spec/html/proofer/fixtures/links/folder/index.html
|
317
|
-
- spec/html/proofer/fixtures/links/folder/index.php
|
318
321
|
- spec/html/proofer/fixtures/links/folder/relativeImage.html
|
319
322
|
- spec/html/proofer/fixtures/links/gpl.png
|
320
323
|
- spec/html/proofer/fixtures/links/hashReferringToSelf.html
|
@@ -337,6 +340,9 @@ test_files:
|
|
337
340
|
- spec/html/proofer/fixtures/links/missingLinkHref.html
|
338
341
|
- spec/html/proofer/fixtures/links/multipleProblems.html
|
339
342
|
- spec/html/proofer/fixtures/links/notarealhash.html
|
343
|
+
- spec/html/proofer/fixtures/links/placeholder_with_empty_id.html
|
344
|
+
- spec/html/proofer/fixtures/links/placeholder_with_id.html
|
345
|
+
- spec/html/proofer/fixtures/links/placeholder_with_name.html
|
340
346
|
- spec/html/proofer/fixtures/links/relativeLinks.html
|
341
347
|
- spec/html/proofer/fixtures/links/rootLink/folder/index.html
|
342
348
|
- spec/html/proofer/fixtures/links/rootLink/index.html
|