html-proofer 2.4.0 → 2.4.1

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: 199072065aae813f6812515b7738fe44e7061b5c
4
- data.tar.gz: bdcb52a9e1ded0ceb863e19969fa1b27dfc583ab
3
+ metadata.gz: 274af0ad1b09d54ed45076fce78d419715e80b71
4
+ data.tar.gz: 7ba668408b6fe5c1bb77052a8af00ac178a6c80d
5
5
  SHA512:
6
- metadata.gz: 8f4e700f69c02bdca9bf0e351fcd768b59b6a27f972a0e8687db668c9e9de24babb4daf75129fd178116e58d2f0eb44c4b808ccc7c584ad4c7626c288eeabd1b
7
- data.tar.gz: 980595b0f55a55aaeaf4d1a6338c1ddd968bc12ec54fb89fb00f95a34f8812e7d869c351852c5f06ffe52a2bb0df115c07bfb79a72d38d43b76d9d2feec91951
6
+ metadata.gz: dfb1ba02f214bf85c84a84a1049290edbfc79b480d831eccb9733d6eb842b4b7929ed7b61535db7e7a4e8ddd60f7e5f98313e33c33e5dab2eb5015c211a8f43e
7
+ data.tar.gz: 6a76b81a593108b8924e0e2dff7c982d1cf73438236df45cff000517b4e0f95aac71f3a14d63e9d0f2a9d21f9767ae8ba3eaaf8e253069b96ff9999d2bb3e428
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9
4
3
  - 2.0
5
4
  - 2.1
6
5
  - 2.2
@@ -10,3 +9,6 @@ env:
10
9
 
11
10
  sudo: false
12
11
  cache: bundler
12
+
13
+ git:
14
+ depth: 10
data/lib/html/proofer.rb CHANGED
@@ -9,6 +9,7 @@ require_all 'proofer'
9
9
  require_all 'proofer/check_runner'
10
10
  require_all 'proofer/checks'
11
11
  require_relative './proofer/utils'
12
+ require_relative './proofer/xpathfunctions'
12
13
 
13
14
  require 'parallel'
14
15
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  class LinkCheckable < ::HTML::Proofer::Checkable
3
2
 
4
3
  def href
@@ -101,7 +100,8 @@ class LinkCheck < ::HTML::Proofer::CheckRunner
101
100
  end
102
101
 
103
102
  def hash_check(html, href_hash)
104
- html.xpath("//*[@id='#{href_hash}']", "//*[@name='#{href_hash}']").length > 0
103
+ html.xpath("//*[case_insensitive_equals(@id, '#{href_hash}')]", \
104
+ "//*[case_insensitive_equals(@name, '#{href_hash}')]", HTML::Proofer::XpathFunctions.new).length > 0
105
105
  end
106
106
 
107
107
  end
@@ -1,6 +1,5 @@
1
1
  module HTML
2
2
  class Proofer
3
- VERSION = '2.4.0'
3
+ VERSION = '2.4.1'
4
4
  end
5
5
  end
6
-
@@ -0,0 +1,9 @@
1
+ module HTML
2
+ class Proofer
3
+ class XpathFunctions
4
+ def case_insensitive_equals(node_set, str_to_match)
5
+ node_set.find_all { |node| node.to_s.downcase == str_to_match.to_s.downcase }
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ <a href="#Android">Android</a>
2
+
3
+ <h2 id="android">Android</h2>
@@ -361,4 +361,10 @@ describe 'Links test' do
361
361
  proofer = run_proofer(fixture)
362
362
  expect(proofer.failed_tests).to eq []
363
363
  end
364
+
365
+ it 'does not complain for internal links with mismatched cases' do
366
+ fixture = "#{FIXTURES_DIR}/links/ignores_cases.html"
367
+ proofer = run_proofer(fixture)
368
+ expect(proofer.failed_tests).to eq []
369
+ end
364
370
  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: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
@@ -207,6 +207,7 @@ files:
207
207
  - lib/html/proofer/url_validator.rb
208
208
  - lib/html/proofer/utils.rb
209
209
  - lib/html/proofer/version.rb
210
+ - lib/html/proofer/xpathfunctions.rb
210
211
  - script/bootstrap
211
212
  - spec/html/proofer/checkable_spec.rb
212
213
  - spec/html/proofer/command_spec.rb
@@ -282,6 +283,7 @@ files:
282
283
  - spec/html/proofer/fixtures/links/head_link_href_empty.html
283
284
  - spec/html/proofer/fixtures/links/ignorableLinks.html
284
285
  - spec/html/proofer/fixtures/links/ignorableLinksViaOptions.html
286
+ - spec/html/proofer/fixtures/links/ignores_cases.html
285
287
  - spec/html/proofer/fixtures/links/invalid_mailto_link.html
286
288
  - spec/html/proofer/fixtures/links/javascript_link.html
287
289
  - spec/html/proofer/fixtures/links/linkToFolder.html
@@ -471,6 +473,7 @@ test_files:
471
473
  - spec/html/proofer/fixtures/links/head_link_href_empty.html
472
474
  - spec/html/proofer/fixtures/links/ignorableLinks.html
473
475
  - spec/html/proofer/fixtures/links/ignorableLinksViaOptions.html
476
+ - spec/html/proofer/fixtures/links/ignores_cases.html
474
477
  - spec/html/proofer/fixtures/links/invalid_mailto_link.html
475
478
  - spec/html/proofer/fixtures/links/javascript_link.html
476
479
  - spec/html/proofer/fixtures/links/linkToFolder.html