html-proofer 1.5.2 → 1.5.3
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 +4 -4
- data/README.md +1 -0
- data/bin/htmlproof +4 -1
- data/lib/html/proofer.rb +2 -0
- data/lib/html/proofer/version.rb +1 -1
- data/spec/html/proofer/links_spec.rb +11 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97c22a8fe51597e114e14ddbba652ae985fc5f57
|
4
|
+
data.tar.gz: 1ddb7a315216b45543e7c9c213cb12ba5bfd51c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 878e34703034b6f5da4ff253966f49c3c0da8b069114ef5884b5f1204c887e80811c7da36153f78ce08a1c6a15fdeb702aa288d7ea3313ee805942479d49e4d8
|
7
|
+
data.tar.gz: 437465770c2958c1e225808afad54758a95d3e962c5d06d22397d8815eadb313d5dc42f04b5ec6329a0a5178f3844029a4918f841203b687c8601cf238d00830
|
data/README.md
CHANGED
@@ -144,6 +144,7 @@ The `HTML::Proofer` constructor takes an optional hash of additional options:
|
|
144
144
|
| `verbose` | If `true`, outputs extra information as the checking happens. Useful for debugging. | `false` |
|
145
145
|
| `only_4xx` | Only reports errors for links that fall within the 4xx status code range. | `false` |
|
146
146
|
| `validate_html` | Enables HTML validation errors from Nokogiri | `false` |
|
147
|
+
| `check_external_hash` | Checks whether external hashes exist (even if the website exists). This slows the checker down. | `false` |
|
147
148
|
|
148
149
|
### Configuring Typhoeus
|
149
150
|
|
data/bin/htmlproof
CHANGED
@@ -21,10 +21,11 @@ Mercenary.program(:htmlproof) do |p|
|
|
21
21
|
p.option 'href_ignore', '--href_ignore link1,[link2,...]', Array, 'Array of Strings containing `href`s that are safe to ignore. Note that non-HTTP(S) URIs are always ignored.'
|
22
22
|
p.option 'alt_ignore', '--alt_ignore image1,[image2,...]', Array, 'Array of Strings containing `img`s whose missing `alt` tags are safe to ignore'
|
23
23
|
p.option 'disable_external', '--disable_external', 'Disables the external link checker (default: `false`)'
|
24
|
-
p.option '
|
24
|
+
p.option 'only_4xx', '--only_4xx', 'Only reports errors for links that fall within the 4x status code range.'
|
25
25
|
p.option 'verbose', '--verbose', 'Enables more verbose logging.'
|
26
26
|
p.option 'directory_index_file', '--directory_index_file', 'Sets the file to look for when a link refers to a directory.'
|
27
27
|
p.option 'validate_html', '--validate_html', 'Enables HTML validation errors from Nokogiri (default: `false`).'
|
28
|
+
p.option 'check_external_hash', '--check_external_hash', 'Checks whether external hashes exist (even if the website exists). This slows the checker down (default: `false`).'
|
28
29
|
|
29
30
|
p.action do |args, opts|
|
30
31
|
args = ["."] if args.empty?
|
@@ -43,10 +44,12 @@ Mercenary.program(:htmlproof) do |p|
|
|
43
44
|
options[:href_ignore] = opts["href_ignore"] unless opts["href_ignore"].nil?
|
44
45
|
options[:alt_ignore] = opts["alt_ignore"] unless opts["alt_ignore"].nil?
|
45
46
|
options[:disable_external] = opts["disable_external"] unless opts["disable_external"].nil?
|
47
|
+
options[:only_4xx] = opts["only_4xx"] unless opts["only_4xx"].nil?
|
46
48
|
options[:favicon] = opts["favicon"] unless opts["favicon"].nil?
|
47
49
|
options[:verbose] = opts["verbose"] unless opts["verbose"].nil?
|
48
50
|
options[:directory_index_file] = opts["directory_index_file"] unless opts["directory_index_file"].nil?
|
49
51
|
options[:validate_html] = opts["validate_html"] unless opts["validate_html"].nil?
|
52
|
+
options[:check_external_hash] = opts["check_external_hash"] unless opts["check_external_hash"].nil?
|
50
53
|
|
51
54
|
path = path.delete(' ').split(",") if opts["as-links"]
|
52
55
|
|
data/lib/html/proofer.rb
CHANGED
@@ -37,6 +37,7 @@ module HTML
|
|
37
37
|
:favicon => false,
|
38
38
|
:href_swap => [],
|
39
39
|
:href_ignore => [],
|
40
|
+
:check_external_hash => false,
|
40
41
|
:alt_ignore => [],
|
41
42
|
:disable_external => false,
|
42
43
|
:verbose => false,
|
@@ -184,6 +185,7 @@ module HTML
|
|
184
185
|
|
185
186
|
if response_code.between?(200, 299)
|
186
187
|
return if @options[:only_4xx]
|
188
|
+
return unless @options[:check_external_hash]
|
187
189
|
if hash = has_hash?(href)
|
188
190
|
body_doc = Nokogiri::HTML(response.body)
|
189
191
|
# user-content is a special addition by GitHub.
|
data/lib/html/proofer/version.rb
CHANGED
@@ -2,19 +2,25 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "Links test" do
|
4
4
|
|
5
|
-
it "fails for broken
|
5
|
+
it "fails for broken internal hash (even if the file exists)" do
|
6
6
|
brokenHashExternalFilepath = "#{FIXTURES_DIR}/links/brokenHashExternal.html"
|
7
7
|
proofer = make_proofer(brokenHashExternalFilepath)
|
8
8
|
expect(proofer.failed_tests.last).to match /linking to ..\/images\/missingImageAlt.html#asdfasfdkafl, but asdfasfdkafl does not exist/
|
9
9
|
end
|
10
10
|
|
11
|
-
it "fails for broken hashes on the web (even if the file exists)" do
|
11
|
+
it "fails for broken hashes on the web when asked (even if the file exists)" do
|
12
12
|
brokenHashOnTheWeb = "#{FIXTURES_DIR}/links/brokenHashOnTheWeb.html"
|
13
|
-
proofer = make_proofer(brokenHashOnTheWeb)
|
13
|
+
proofer = make_proofer(brokenHashOnTheWeb, { :check_external_hash => true} )
|
14
14
|
expect(proofer.failed_tests.first).to match /but the hash 'no' does not/
|
15
15
|
end
|
16
16
|
|
17
|
-
it "passes for
|
17
|
+
it "passes for broken hashes on the web when ignored (even if the file exists)" do
|
18
|
+
brokenHashOnTheWeb = "#{FIXTURES_DIR}/links/brokenHashOnTheWeb.html"
|
19
|
+
proofer = make_proofer(brokenHashOnTheWeb)
|
20
|
+
expect(proofer.failed_tests).to eq []
|
21
|
+
end
|
22
|
+
|
23
|
+
it "passes for GitHub hashes on the web when asked" do
|
18
24
|
githubHash = "#{FIXTURES_DIR}/links/githubHash.html"
|
19
25
|
proofer = make_proofer(githubHash)
|
20
26
|
expect(proofer.failed_tests).to eq []
|
@@ -291,7 +297,7 @@ describe "Links test" do
|
|
291
297
|
|
292
298
|
it "does not dupe errors" do
|
293
299
|
fixture = "#{FIXTURES_DIR}/links/nodupe.html"
|
294
|
-
proofer = make_proofer(fixture)
|
300
|
+
proofer = make_proofer(fixture, { :check_external_hash => true} )
|
295
301
|
expect(proofer.failed_tests.length).to eq 1
|
296
302
|
end
|
297
303
|
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: 1.5.
|
4
|
+
version: 1.5.3
|
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-11-
|
11
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|
@@ -320,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
320
320
|
version: '0'
|
321
321
|
requirements: []
|
322
322
|
rubyforge_project:
|
323
|
-
rubygems_version: 2.2.
|
323
|
+
rubygems_version: 2.2.0
|
324
324
|
signing_key:
|
325
325
|
specification_version: 4
|
326
326
|
summary: A set of tests to validate your HTML output. These tests check if your image
|