html-proofer 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/html/proofer/checkable.rb +2 -1
- data/lib/html/proofer/version.rb +1 -1
- data/spec/html/proofer/fixtures/ignorableImages.html +10 -0
- data/spec/html/proofer/fixtures/ignorableLinks.html +13 -0
- data/spec/html/proofer/images_spec.rb +7 -0
- data/spec/html/proofer/links_spec.rb +7 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 185d85305a997ab32e3329e54ed9b83a95569527
|
4
|
+
data.tar.gz: 2bb28f53766e220fda2486332f520d76cd6bb771
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1c0b42b8e196a4ac5d1a2e3cd074d2a768cd846711a08d60506c2c36631cd22757f410e2500bc4c944420a6dd261dedcce8381feb7b5495214b9292392f445a
|
7
|
+
data.tar.gz: e9d01ee50d2c57ac27ed68ead827e4df329d2d0ef61644f27bacf5cd128de571f9e9af1f74658b9f0bbde2a83895df9735f201d369fbd706afae0b705af59b2e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -81,3 +81,5 @@ The `HTML::Proofer` constructor takes an optional hash of additional options:
|
|
81
81
|
* `:ext`: the extension (including the `.`) of your HTML files (default: `.html`)
|
82
82
|
* `:href_swap`: a hash containing key-value pairs of `RegExp => String`. It transforms links that match `RegExp` into `String` via `gsub`.
|
83
83
|
* `:href_ignore`: an array of Strings containing `href`s that are safe to ignore (default: `mailto`)
|
84
|
+
|
85
|
+
To any `<a>` or `<img>` tag, you may add the `data-proofer-ignore` attribute to ignore the link.
|
@@ -8,6 +8,7 @@ module HTML
|
|
8
8
|
@alt = obj['alt']
|
9
9
|
@name = obj['name']
|
10
10
|
@id = obj['id']
|
11
|
+
@data_ignore_proofer = obj['data-proofer-ignore']
|
11
12
|
@check = check
|
12
13
|
|
13
14
|
if @href && @check.options[:href_swap]
|
@@ -54,7 +55,7 @@ module HTML
|
|
54
55
|
|
55
56
|
def ignore?
|
56
57
|
uri = URI.parse url
|
57
|
-
%w( mailto ).include?(uri.scheme) || @check.additional_href_ignores.include?(href)
|
58
|
+
@data_ignore_proofer || %w( mailto ).include?(uri.scheme) || @check.additional_href_ignores.include?(href)
|
58
59
|
rescue URI::BadURIError
|
59
60
|
false
|
60
61
|
rescue URI::InvalidURIError
|
data/lib/html/proofer/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
<html>
|
2
|
+
|
3
|
+
<body>
|
4
|
+
|
5
|
+
<a href="http://www.asdo3IRJ395295jsingrkrg4.com" data-proofer-ignore="true">broken link!</a>
|
6
|
+
|
7
|
+
<a href="#anadaasdadsadschor" data-proofer-ignore=true>Anchor relative to nothing</a>
|
8
|
+
|
9
|
+
<a href="../whaadadt.html" data-proofer-ignore>Relative to nothing</a>
|
10
|
+
|
11
|
+
</body>
|
12
|
+
|
13
|
+
</html>
|
@@ -51,4 +51,11 @@ describe "Image tests" do
|
|
51
51
|
@imageCheck.run
|
52
52
|
@imageCheck.issues[0].should eq("spec/html/proofer/fixtures/terribleImageName.html".blue + ": image has a terrible filename (./Screen Shot 2012-08-09 at 7.51.18 AM.png)")
|
53
53
|
end
|
54
|
+
|
55
|
+
it 'ignores images marked as ignore data-proofer-ignore' do
|
56
|
+
ignorableImages = "#{FIXTURES_DIR}/ignorableImages.html"
|
57
|
+
@linkCheck = Links.new("#{FIXTURES_DIR}", ignorableImages, HTML::Proofer.create_nokogiri(ignorableImages))
|
58
|
+
@linkCheck.run
|
59
|
+
@linkCheck.issues[0].should eq(nil)
|
60
|
+
end
|
54
61
|
end
|
@@ -80,4 +80,11 @@ describe "Links tests" do
|
|
80
80
|
@linkCheck.run
|
81
81
|
@linkCheck.issues[0].should eq(nil)
|
82
82
|
end
|
83
|
+
|
84
|
+
it 'ignores links marked as ignore data-proofer-ignore' do
|
85
|
+
ignorableLinks = "#{FIXTURES_DIR}/ignorableLinks.html"
|
86
|
+
@linkCheck = Links.new("#{FIXTURES_DIR}", ignorableLinks, HTML::Proofer.create_nokogiri(ignorableLinks))
|
87
|
+
@linkCheck.run
|
88
|
+
@linkCheck.issues[0].should eq(nil)
|
89
|
+
end
|
83
90
|
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: 0.
|
4
|
+
version: 0.2.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: 2013-10-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -128,6 +128,8 @@ files:
|
|
128
128
|
- spec/html/proofer/fixtures/folder/anchorLink.html
|
129
129
|
- spec/html/proofer/fixtures/folder/index.html
|
130
130
|
- spec/html/proofer/fixtures/gpl.png
|
131
|
+
- spec/html/proofer/fixtures/ignorableImages.html
|
132
|
+
- spec/html/proofer/fixtures/ignorableLinks.html
|
131
133
|
- spec/html/proofer/fixtures/index.html
|
132
134
|
- spec/html/proofer/fixtures/linkToFolder.html
|
133
135
|
- spec/html/proofer/fixtures/linkWithHttps.html
|
@@ -184,6 +186,8 @@ test_files:
|
|
184
186
|
- spec/html/proofer/fixtures/folder/anchorLink.html
|
185
187
|
- spec/html/proofer/fixtures/folder/index.html
|
186
188
|
- spec/html/proofer/fixtures/gpl.png
|
189
|
+
- spec/html/proofer/fixtures/ignorableImages.html
|
190
|
+
- spec/html/proofer/fixtures/ignorableLinks.html
|
187
191
|
- spec/html/proofer/fixtures/index.html
|
188
192
|
- spec/html/proofer/fixtures/linkToFolder.html
|
189
193
|
- spec/html/proofer/fixtures/linkWithHttps.html
|