html-proofer 0.5.0 → 0.6.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: 0d99f984fc2f22c8190888bbef42ddcbc6eb311f
4
- data.tar.gz: a9a5b78b906cc5602bcdf352c63590bd58bcce07
3
+ metadata.gz: 033e57eb82d6d3f2504faf1dbc56545692b4f09b
4
+ data.tar.gz: 39d300ef45a4a96e202640017da0cb274a35b45b
5
5
  SHA512:
6
- metadata.gz: 09a1bd824416b1c5331e0fbf20c3fa6b56f71b9ef8e423ffa42efb368b6834d687fe003e2a9d368ccc9f1126cdfbaea542c56c391d99f66e3623404cb0a7050b
7
- data.tar.gz: cc1c3a8d29756c4149ac2ac11696c176762934ca6117eb46ce0c98e6662e8be1291da2ead0ec46f258b355b233229b4637ad22510ab058ef0d436151fcdd6506
6
+ metadata.gz: 9a11d8ce720aed31d0faa6e76b2376d5e7985098a17552b80d7828768713983055de269f939e7110337dfbff3d323229825f557d2d1890fc56423217fb89303a
7
+ data.tar.gz: 46e06af17e6c1e9da744b5f208189b4848ab805df2b1100adc54b12b45fab7dc87c9c2169cf2b90eb5d169a9548844dad49229a1f0808f81b7c4ca29b4e41f6b
data/README.md CHANGED
@@ -102,7 +102,7 @@ The `HTML::Proofer` constructor takes an optional hash of additional options:
102
102
 
103
103
  * `:ext`: the extension (including the `.`) of your HTML files (default: `.html`)
104
104
  * `:href_swap`: a hash containing key-value pairs of `RegExp => String`. It transforms links that match `RegExp` into `String` via `gsub`.
105
- * `:href_ignore`: an array of Strings containing `href`s that are safe to ignore (by default, `mailto` is always ignored)
105
+ * `:href_ignore`: an array of Strings or RegExps containing `href`s that are safe to ignore (`mailto` is always ignored)
106
106
  * `:disable_external`: if `true`, does not run the external link checker, which can take a lot of time (default: `false`)
107
107
 
108
108
  You can also pass in any of Typhoeus' options for the external link check. For example:
@@ -61,6 +61,16 @@ module HTML
61
61
 
62
62
  def ignore?
63
63
  return true if @ignored || @data_ignore_proofer || @check.additional_href_ignores.include?(url)
64
+ unless @check.additional_href_ignores.empty?
65
+ @check.additional_href_ignores.each do |href_ignore|
66
+ if href_ignore.is_a? String
67
+ return true if href_ignore == url
68
+ elsif href_ignore.is_a? Regexp
69
+ return true if href_ignore =~ url
70
+ end
71
+ end
72
+ end
73
+
64
74
  uri = URI.parse url
65
75
  %w( mailto ).include?(uri.scheme)
66
76
  rescue URI::BadURIError
@@ -1,5 +1,5 @@
1
1
  module HTML
2
2
  class Proofer
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
@@ -0,0 +1,13 @@
1
+ <html>
2
+
3
+ <body>
4
+
5
+ <a href="http://www.asdo3IRJ395295jsingrkrg4.com">broken link!</a>
6
+
7
+ <a href="#anadaasdadsadschor">Anchor relative to nothing</a>
8
+
9
+ <a href="../whaadadt.html">Relative to nothing</a>
10
+
11
+ </body>
12
+
13
+ </html>
@@ -5,6 +5,8 @@
5
5
  <p>Blah blah blah. <a href="http://github.github.com/github-flavored-markdown/">This is a redirect.</a>. </p>
6
6
 
7
7
  <p>Blah blah blah. <a href="https://help.github.com/changing-author-info/">This is another redirect.</a>. </p>
8
+
9
+ <p>Blah blah blah. <a href="http://timclem.wordpress.com/2012/03/01/mind-the-end-of-your-line/">This is a third redirect.</a>. </p>
8
10
  </body>
9
11
 
10
12
  </html>
@@ -80,6 +80,12 @@ describe "Links tests" do
80
80
  output.should == ""
81
81
  end
82
82
 
83
+ it 'ignores links via href_ignore' do
84
+ ignorableLinks = "#{FIXTURES_DIR}/ignorableLinksViaOptions.html"
85
+ output = capture_stderr { HTML::Proofer.new(ignorableLinks, {:href_ignore => [/^http:\/\//, /sdadsad/, "../whaadadt.html"]}).run }
86
+ output.should == ""
87
+ end
88
+
83
89
  it 'translates links via href_swap' do
84
90
  translatedLink = "#{FIXTURES_DIR}/linkTranslatedViaHrefSwap.html"
85
91
  output = capture_stderr { HTML::Proofer.new(translatedLink, {:href_swap => { /\A\/articles\/([\w-]+)/ => "\\1.html" }}).run }
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.5.0
4
+ version: 0.6.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: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mercenary
@@ -146,6 +146,7 @@ files:
146
146
  - spec/html/proofer/fixtures/gpl.png
147
147
  - spec/html/proofer/fixtures/ignorableImages.html
148
148
  - spec/html/proofer/fixtures/ignorableLinks.html
149
+ - spec/html/proofer/fixtures/ignorableLinksViaOptions.html
149
150
  - spec/html/proofer/fixtures/index.html
150
151
  - spec/html/proofer/fixtures/linkToFolder.html
151
152
  - spec/html/proofer/fixtures/linkTranslatedViaHrefSwap.html
@@ -214,6 +215,7 @@ test_files:
214
215
  - spec/html/proofer/fixtures/gpl.png
215
216
  - spec/html/proofer/fixtures/ignorableImages.html
216
217
  - spec/html/proofer/fixtures/ignorableLinks.html
218
+ - spec/html/proofer/fixtures/ignorableLinksViaOptions.html
217
219
  - spec/html/proofer/fixtures/index.html
218
220
  - spec/html/proofer/fixtures/linkToFolder.html
219
221
  - spec/html/proofer/fixtures/linkTranslatedViaHrefSwap.html
@@ -239,3 +241,4 @@ test_files:
239
241
  - spec/html/proofer/links_spec.rb
240
242
  - spec/html/proofer/version_spec.rb
241
243
  - spec/spec_helper.rb
244
+ has_rdoc: