html-proofer 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6fdca322142a45bad728b408d6e00e155fe01ce
4
- data.tar.gz: 288123bd8384f03768178f352a90729e85101b89
3
+ metadata.gz: c29174a0c6d66b27477dfa875f55ddaaf5233703
4
+ data.tar.gz: 53abcd611dd9bea328900554a44e2480c061056d
5
5
  SHA512:
6
- metadata.gz: 997be4ed93329ceb98a5fd2aa6caf7b1e664d78fc9c65057c4c76e766ada8851f4c4edb1756a80c5f54313f97048ce867bf5337d1266b62a3831d514ede33856
7
- data.tar.gz: 88defb2fc1bda8ffa7a15f8fda61efcdb943074513eb73738613b556c84c75b33f4d35fa8debbd79d8fb0b33fbbe1c7a858dca396770cf4c97ef63b0655c0ee5
6
+ metadata.gz: 56af59c05d01d8401ff70cab45f46960afd81b03588ba5054f8f5b97dc5f68564ccefddd79aafce0c94f74b1b1b8a2441621970e38dea84c708a8488b1a0af0f
7
+ data.tar.gz: b9402d34ea0c1f5ffe9e5ba9b6657b557a9ed86d73f6cee8a741034ffba39b1f82d042eec40d20cdf0ec8570ec15a31a6c51291d62c35aa6e98c052c3c20f2f4
@@ -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.1.0"
6
+ gem.version = "1.1.1"
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.}
@@ -11,7 +11,7 @@ class Favicons < ::HTML::Proofer::Checks::Check
11
11
  def run
12
12
  return unless @options[:favicon]
13
13
 
14
- @html.css("link").each do |favicon|
14
+ @html.xpath("//link[not(ancestor::pre or ancestor::code)]").each do |favicon|
15
15
  favicon = Favicon.new favicon, "favicon", self
16
16
  return if favicon.rel.split(" ").last.eql? "icon"
17
17
  end
@@ -24,7 +24,7 @@ end
24
24
 
25
25
  class Images < ::HTML::Proofer::Checks::Check
26
26
  def run
27
- @html.css('img').each do |i|
27
+ @html.xpath('//img[not(ancestor::pre or ancestor::code)]').each do |i|
28
28
  img = Image.new i, "image", self
29
29
 
30
30
  next if img.ignore?
@@ -19,7 +19,7 @@ end
19
19
  class Links < ::HTML::Proofer::Checks::Check
20
20
 
21
21
  def run
22
- @html.css('a, link').each do |l|
22
+ @html.xpath('//a[not(ancestor::pre or ancestor::code)]', '//link[not(ancestor::pre or ancestor::code)]').each do |l|
23
23
  link = Link.new l, "link", self
24
24
 
25
25
  next if link.ignore?
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  class Scripts < ::HTML::Proofer::Checks::Check
20
20
  def run
21
- @html.css('script').each do |s|
21
+ @html.xpath('//script[not(ancestor::pre or ancestor::code)]').each do |s|
22
22
  script = Script.new s, "script", self
23
23
 
24
24
  next if script.ignore?
@@ -0,0 +1,12 @@
1
+ <pre>
2
+
3
+ <a href="http://www.asdo3IRJ395295jsingrkrg4.com">broken link!</a>
4
+ </pre>
5
+
6
+
7
+ <code>
8
+
9
+
10
+ <a href="http://www.asdo3IRJ395295jsingrkrg4.com">broken link!</a>
11
+
12
+ </code>
@@ -0,0 +1,13 @@
1
+
2
+ <pre>
3
+
4
+ <link rel="icon" href="">
5
+ </pre>
6
+
7
+
8
+ <code>
9
+
10
+
11
+ <link rel="icon" href="">
12
+
13
+ </code>
@@ -0,0 +1,5 @@
1
+ <pre lang="html"><code><script src="https://embed.github.com/view/geojson/<username>/<repo>/<ref>/<path_to_file>"></script>
2
+ </code></pre>
3
+
4
+ <code><script src="https://embed.github.com/view/geojson/<username>/<repo>/<ref>/<path_to_file>"></script>
5
+ </code>
@@ -171,4 +171,16 @@ describe "Links test" do
171
171
  output = capture_stderr { HTML::Proofer.new(["www.github.com", "foofoofoo.biz"], options).run }
172
172
  output.should match /foofoo.biz\/? failed: 0 Couldn't resolve host name/
173
173
  end
174
+
175
+ it "works for broken anchors within pre" do
176
+ anchor_pre = "#{FIXTURES_DIR}/links/anchors_in_pre.html"
177
+ output = capture_stderr { HTML::Proofer.new(anchor_pre).run }
178
+ output.should == ""
179
+ end
180
+
181
+ it "works for broken link within pre" do
182
+ link_pre = "#{FIXTURES_DIR}/links/links_in_pre.html"
183
+ output = capture_stderr { HTML::Proofer.new(link_pre).run }
184
+ output.should == ""
185
+ end
174
186
  end
@@ -32,4 +32,10 @@ describe "Scripts test" do
32
32
  output.should match /script is empty and has no src attribute/
33
33
  end
34
34
 
35
+ it "works for broken script within pre" do
36
+ script_pre = "#{FIXTURES_DIR}/scripts/script_in_pre.html"
37
+ output = capture_stderr { HTML::Proofer.new(script_pre).run }
38
+ output.should == ""
39
+ end
40
+
35
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-proofer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
@@ -182,6 +182,7 @@ files:
182
182
  - spec/html/proofer/fixtures/images/rootRelativeImages.html
183
183
  - spec/html/proofer/fixtures/images/terribleImageName.html
184
184
  - spec/html/proofer/fixtures/images/workingDataURIImage.html
185
+ - spec/html/proofer/fixtures/links/anchors_in_pre.html
185
186
  - spec/html/proofer/fixtures/links/blank_mailto_link.html
186
187
  - spec/html/proofer/fixtures/links/blank_tel_link.html
187
188
  - spec/html/proofer/fixtures/links/brokenHashExternal.html
@@ -209,6 +210,7 @@ files:
209
210
  - spec/html/proofer/fixtures/links/link_directory_without_slash.html
210
211
  - spec/html/proofer/fixtures/links/link_missing_protocol_invalid.html
211
212
  - spec/html/proofer/fixtures/links/link_missing_protocol_valid.html
213
+ - spec/html/proofer/fixtures/links/links_in_pre.html
212
214
  - spec/html/proofer/fixtures/links/mailto_link.html
213
215
  - spec/html/proofer/fixtures/links/missingLinkHref.html
214
216
  - spec/html/proofer/fixtures/links/multipleProblems.html
@@ -226,6 +228,7 @@ files:
226
228
  - spec/html/proofer/fixtures/scripts/script_broken_external.html
227
229
  - spec/html/proofer/fixtures/scripts/script_content.html
228
230
  - spec/html/proofer/fixtures/scripts/script_content_absent.html
231
+ - spec/html/proofer/fixtures/scripts/script_in_pre.html
229
232
  - spec/html/proofer/fixtures/scripts/script_missing_internal.html
230
233
  - spec/html/proofer/fixtures/scripts/script_valid_internal.html
231
234
  - spec/html/proofer/images_spec.rb
@@ -282,6 +285,7 @@ test_files:
282
285
  - spec/html/proofer/fixtures/images/rootRelativeImages.html
283
286
  - spec/html/proofer/fixtures/images/terribleImageName.html
284
287
  - spec/html/proofer/fixtures/images/workingDataURIImage.html
288
+ - spec/html/proofer/fixtures/links/anchors_in_pre.html
285
289
  - spec/html/proofer/fixtures/links/blank_mailto_link.html
286
290
  - spec/html/proofer/fixtures/links/blank_tel_link.html
287
291
  - spec/html/proofer/fixtures/links/brokenHashExternal.html
@@ -309,6 +313,7 @@ test_files:
309
313
  - spec/html/proofer/fixtures/links/link_directory_without_slash.html
310
314
  - spec/html/proofer/fixtures/links/link_missing_protocol_invalid.html
311
315
  - spec/html/proofer/fixtures/links/link_missing_protocol_valid.html
316
+ - spec/html/proofer/fixtures/links/links_in_pre.html
312
317
  - spec/html/proofer/fixtures/links/mailto_link.html
313
318
  - spec/html/proofer/fixtures/links/missingLinkHref.html
314
319
  - spec/html/proofer/fixtures/links/multipleProblems.html
@@ -326,6 +331,7 @@ test_files:
326
331
  - spec/html/proofer/fixtures/scripts/script_broken_external.html
327
332
  - spec/html/proofer/fixtures/scripts/script_content.html
328
333
  - spec/html/proofer/fixtures/scripts/script_content_absent.html
334
+ - spec/html/proofer/fixtures/scripts/script_in_pre.html
329
335
  - spec/html/proofer/fixtures/scripts/script_missing_internal.html
330
336
  - spec/html/proofer/fixtures/scripts/script_valid_internal.html
331
337
  - spec/html/proofer/images_spec.rb