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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d582fc037bc612dee8f91f0c6cae8ce69add076e
4
- data.tar.gz: ab0c71aed1e108da6ea8101c865cbdaebdf74c7d
3
+ metadata.gz: 185d85305a997ab32e3329e54ed9b83a95569527
4
+ data.tar.gz: 2bb28f53766e220fda2486332f520d76cd6bb771
5
5
  SHA512:
6
- metadata.gz: c82827dada38e85814a4cfe6e09bef5b9559f4aeca9a8bd2929b36a01ea0665dd0fff4b51b0815b9b5ec7eec2b5f8df861aa6423164852543a8184a4823b56ad
7
- data.tar.gz: 5c33939c0b8f1f0a6ede99a946ce61b1f3a3000be4bf2a4f77b6706766ded159d6502f4751955a599a6394591105331cea5536d9f0a0a1641a51435385c8f7d3
6
+ metadata.gz: e1c0b42b8e196a4ac5d1a2e3cd074d2a768cd846711a08d60506c2c36631cd22757f410e2500bc4c944420a6dd261dedcce8381feb7b5495214b9292392f445a
7
+ data.tar.gz: e9d01ee50d2c57ac27ed68ead827e4df329d2d0ef61644f27bacf5cd128de571f9e9af1f74658b9f0bbde2a83895df9735f201d369fbd706afae0b705af59b2e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- html-proofer (0.1.0)
4
+ html-proofer (0.1.1)
5
5
  colored (~> 1.2)
6
6
  nokogiri (= 1.6.0)
7
7
  typhoeus (~> 0.6.3)
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
@@ -1,5 +1,5 @@
1
1
  module HTML
2
2
  class Proofer
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -0,0 +1,10 @@
1
+ <html>
2
+
3
+ <body>
4
+
5
+ <p>Blah blah blah. <img alt="A broken image" src="http://www.whatthehell" data-proofer-ignore="true" /> </p>
6
+
7
+
8
+ </body>
9
+
10
+ </html>
@@ -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.1.1
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-15 00:00:00.000000000 Z
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