html-proofer 2.3.0 → 3.0.0
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/bin/htmlproofer +85 -0
- data/lib/html-proofer/cache.rb +153 -0
- data/lib/html-proofer/check/favicon.rb +15 -0
- data/lib/html-proofer/check/html.rb +21 -0
- data/lib/html-proofer/check/images.rb +47 -0
- data/lib/html-proofer/check/links.rb +120 -0
- data/lib/html-proofer/check/scripts.rb +28 -0
- data/lib/html-proofer/check.rb +63 -0
- data/lib/html-proofer/configuration.rb +56 -0
- data/lib/html-proofer/element.rb +165 -0
- data/lib/{html/proofer/check_runner → html-proofer}/issue.rb +8 -10
- data/lib/html-proofer/log.rb +49 -0
- data/lib/html-proofer/runner.rb +160 -0
- data/lib/html-proofer/url_validator.rb +218 -0
- data/lib/html-proofer/utils.rb +40 -0
- data/lib/html-proofer/version.rb +3 -0
- data/lib/html-proofer.rb +47 -0
- metadata +64 -289
- data/.gitignore +0 -26
- data/.travis.yml +0 -12
- data/Gemfile +0 -3
- data/LICENSE.txt +0 -22
- data/README.md +0 -265
- data/Rakefile +0 -21
- data/bin/htmlproof +0 -71
- data/html-proofer.gemspec +0 -31
- data/lib/html/proofer/check_runner.rb +0 -62
- data/lib/html/proofer/checkable.rb +0 -164
- data/lib/html/proofer/checks/favicon.rb +0 -21
- data/lib/html/proofer/checks/html.rb +0 -40
- data/lib/html/proofer/checks/images.rb +0 -57
- data/lib/html/proofer/checks/links.rb +0 -107
- data/lib/html/proofer/checks/scripts.rb +0 -39
- data/lib/html/proofer/log.rb +0 -38
- data/lib/html/proofer/url_validator.rb +0 -135
- data/lib/html/proofer/utils.rb +0 -24
- data/lib/html/proofer/version.rb +0 -6
- data/lib/html/proofer.rb +0 -189
- data/script/bootstrap +0 -5
- data/spec/html/proofer/checkable_spec.rb +0 -47
- data/spec/html/proofer/command_spec.rb +0 -88
- data/spec/html/proofer/favicon_spec.rb +0 -47
- data/spec/html/proofer/fixtures/favicon/favicon_absent.html +0 -4
- data/spec/html/proofer/fixtures/favicon/favicon_absent_apple.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_broken.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_broken_but_ignored.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_present.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_present_shortcut.html +0 -7
- data/spec/html/proofer/fixtures/html/div_inside_head.html +0 -6
- data/spec/html/proofer/fixtures/html/html5_tags.html +0 -9
- data/spec/html/proofer/fixtures/html/invalid_tag.html +0 -3
- data/spec/html/proofer/fixtures/html/missing_closing_quotes.html +0 -5
- data/spec/html/proofer/fixtures/html/opening_and_ending_tag_mismatch.html +0 -7
- data/spec/html/proofer/fixtures/html/svg_elements.html +0 -729
- data/spec/html/proofer/fixtures/html/unescaped_ampersand_in_attribute.html +0 -4
- data/spec/html/proofer/fixtures/html/unmatched_end_tag.html +0 -5
- data/spec/html/proofer/fixtures/images/emptyImageAltText.html +0 -10
- data/spec/html/proofer/fixtures/images/existingImageExternal.html +0 -9
- data/spec/html/proofer/fixtures/images/gpl.png +0 -0
- data/spec/html/proofer/fixtures/images/ignorableAltViaOptions.html +0 -13
- data/spec/html/proofer/fixtures/images/ignorableImages.html +0 -10
- data/spec/html/proofer/fixtures/images/ignoreAltButNotLink.html +0 -13
- data/spec/html/proofer/fixtures/images/image_missing_protocol_invalid.html +0 -9
- data/spec/html/proofer/fixtures/images/image_missing_protocol_valid.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageAlt.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageAltText.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageExternal.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageInternal.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageSrc.html +0 -9
- data/spec/html/proofer/fixtures/images/relativeToSelf.html +0 -2
- data/spec/html/proofer/fixtures/images/rootRelativeImages.html +0 -2
- data/spec/html/proofer/fixtures/images/srcSetCheck.html +0 -7
- data/spec/html/proofer/fixtures/images/srcSetIgnorable.html +0 -13
- data/spec/html/proofer/fixtures/images/srcSetMissingAlt.html +0 -7
- data/spec/html/proofer/fixtures/images/srcSetMissingImage.html +0 -7
- data/spec/html/proofer/fixtures/images/terribleImageName.html +0 -9
- data/spec/html/proofer/fixtures/images/workingDataURIImage.html +0 -3
- data/spec/html/proofer/fixtures/links/_site/folder.html/index.html +0 -1
- data/spec/html/proofer/fixtures/links/anchors_in_pre.html +0 -12
- data/spec/html/proofer/fixtures/links/attributeWithDash.html +0 -8
- data/spec/html/proofer/fixtures/links/blank_mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/blank_tel_link.html +0 -9
- data/spec/html/proofer/fixtures/links/brokenHashExternal.html +0 -11
- data/spec/html/proofer/fixtures/links/brokenHashInternal.html +0 -14
- data/spec/html/proofer/fixtures/links/brokenHashOnTheWeb.html +0 -2
- data/spec/html/proofer/fixtures/links/brokenInternalLink.html +0 -0
- data/spec/html/proofer/fixtures/links/brokenLinkExternal.html +0 -11
- data/spec/html/proofer/fixtures/links/brokenLinkInternal.html +0 -10
- data/spec/html/proofer/fixtures/links/brokenLinkWithNumber.html +0 -8
- data/spec/html/proofer/fixtures/links/brokenUnixLinks.html +0 -5
- data/spec/html/proofer/fixtures/links/broken_hash_with_query.html +0 -9
- data/spec/html/proofer/fixtures/links/checkSSLLinks.html +0 -1
- data/spec/html/proofer/fixtures/links/ensure_typhoeus_options.html +0 -1
- data/spec/html/proofer/fixtures/links/erstiebegr%C3%BC%C3%9Fung.html +0 -0
- data/spec/html/proofer/fixtures/links/erstiebegr/303/274/303/237ung.html +0 -0
- data/spec/html/proofer/fixtures/links/escape_pipes.html +0 -9
- data/spec/html/proofer/fixtures/links/file.foo +0 -11
- data/spec/html/proofer/fixtures/links/folder/anchorLink.html +0 -0
- data/spec/html/proofer/fixtures/links/folder/assets/barrel.png +0 -0
- data/spec/html/proofer/fixtures/links/folder/index.html +0 -0
- data/spec/html/proofer/fixtures/links/folder/multiples/catalog/file.html +0 -8
- data/spec/html/proofer/fixtures/links/folder/multiples/javadoc/file.html +0 -8
- data/spec/html/proofer/fixtures/links/folder/relativeImage.html +0 -2
- data/spec/html/proofer/fixtures/links/folder-php/index.php +0 -2
- data/spec/html/proofer/fixtures/links/githubHash.html +0 -1
- data/spec/html/proofer/fixtures/links/gpl.png +0 -0
- data/spec/html/proofer/fixtures/links/hashReferringToSelf.html +0 -44
- data/spec/html/proofer/fixtures/links/head_link_href.html +0 -7
- data/spec/html/proofer/fixtures/links/head_link_href_absent.html +0 -7
- data/spec/html/proofer/fixtures/links/head_link_href_empty.html +0 -7
- data/spec/html/proofer/fixtures/links/ignorableLinks.html +0 -13
- data/spec/html/proofer/fixtures/links/ignorableLinksViaOptions.html +0 -13
- data/spec/html/proofer/fixtures/links/invalid_mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/javascript_link.html +0 -9
- data/spec/html/proofer/fixtures/links/linkToFolder.html +0 -9
- data/spec/html/proofer/fixtures/links/linkTranslatedViaHrefSwap.html +0 -9
- data/spec/html/proofer/fixtures/links/linkWithHttps.html +0 -9
- data/spec/html/proofer/fixtures/links/linkWithRedirect.html +0 -12
- data/spec/html/proofer/fixtures/links/link_directory_without_slash.html +0 -1
- data/spec/html/proofer/fixtures/links/link_missing_protocol_invalid.html +0 -9
- data/spec/html/proofer/fixtures/links/link_missing_protocol_valid.html +0 -9
- data/spec/html/proofer/fixtures/links/link_pointing_to_directory.html +0 -1
- data/spec/html/proofer/fixtures/links/links_in_pre.html +0 -13
- data/spec/html/proofer/fixtures/links/mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/missingLinkHref.html +0 -9
- data/spec/html/proofer/fixtures/links/multipleProblems.html +0 -11
- data/spec/html/proofer/fixtures/links/nodupe.html +0 -1
- data/spec/html/proofer/fixtures/links/non_standard_characters.html +0 -10
- data/spec/html/proofer/fixtures/links/notarealhash.html +0 -0
- data/spec/html/proofer/fixtures/links/other_protocols.html +0 -4
- data/spec/html/proofer/fixtures/links/placeholder_with_empty_id.html +0 -1
- data/spec/html/proofer/fixtures/links/placeholder_with_id.html +0 -1
- data/spec/html/proofer/fixtures/links/placeholder_with_name.html +0 -1
- data/spec/html/proofer/fixtures/links/redirected_error.html +0 -1
- data/spec/html/proofer/fixtures/links/relativeLinks.html +0 -4
- data/spec/html/proofer/fixtures/links/rootLink/folder/index.html +0 -1
- data/spec/html/proofer/fixtures/links/rootLink/index.html +0 -1
- data/spec/html/proofer/fixtures/links/rootLink/rootLink.html +0 -9
- data/spec/html/proofer/fixtures/links/tel_link.html +0 -9
- data/spec/html/proofer/fixtures/links/urlencoded-href.html +0 -2
- data/spec/html/proofer/fixtures/links/utf8Link.html +0 -2
- data/spec/html/proofer/fixtures/resources/Screen Shot 2012-08-09 at 7.51.18 AM.png +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/getting-good-with-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/pro-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/version-control-with-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/nestedRelativeImages.html +0 -5
- data/spec/html/proofer/fixtures/resources/gpl.png +0 -0
- data/spec/html/proofer/fixtures/scripts/ignorableLinksViaOptions.html +0 -4
- data/spec/html/proofer/fixtures/scripts/script.js +0 -1
- data/spec/html/proofer/fixtures/scripts/script_broken_external.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_content.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_content_absent.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_in_pre.html +0 -5
- data/spec/html/proofer/fixtures/scripts/script_missing_internal.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_valid_internal.html +0 -9
- data/spec/html/proofer/fixtures/sorting/issue/broken_image_one.html +0 -1
- data/spec/html/proofer/fixtures/sorting/issue/broken_image_two.html +0 -4
- data/spec/html/proofer/fixtures/sorting/path/multiple_issues.html +0 -11
- data/spec/html/proofer/fixtures/sorting/path/single_issue.html +0 -1
- data/spec/html/proofer/fixtures/sorting/status/a_404.html +0 -1
- data/spec/html/proofer/fixtures/sorting/status/broken_link.html +0 -3
- data/spec/html/proofer/fixtures/sorting/status/missing_redirect.html +0 -1
- data/spec/html/proofer/fixtures/utils/lang-jp.html +0 -1
- data/spec/html/proofer/html_spec.rb +0 -57
- data/spec/html/proofer/images_spec.rb +0 -147
- data/spec/html/proofer/links_spec.rb +0 -364
- data/spec/html/proofer/scripts_spec.rb +0 -47
- data/spec/html/proofer/utils_spec.rb +0 -14
- data/spec/html/proofer_spec.rb +0 -122
- data/spec/spec_helper.rb +0 -52
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Command test' do
|
|
4
|
-
it 'works with as-links' do
|
|
5
|
-
output = make_bin('--as-links www.github.com,foofoofoo.biz')
|
|
6
|
-
expect(output).to match('1 failure')
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
it 'works with alt-ignore' do
|
|
10
|
-
ignorableLinks = "#{FIXTURES_DIR}/images/ignorableAltViaOptions.html"
|
|
11
|
-
output = make_bin('--alt-ignore /wikimedia/,gpl.png', ignorableLinks)
|
|
12
|
-
expect(output).to match('successfully')
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it 'works with checks_to_ignore' do
|
|
16
|
-
external = "#{FIXTURES_DIR}/links/file.foo"
|
|
17
|
-
output = make_bin('--ext .foo --checks-to-ignore LinkCheck', external)
|
|
18
|
-
expect(output).to match('successfully')
|
|
19
|
-
expect(output).to_not match('LinkCheck')
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'works with check-external-hash' do
|
|
23
|
-
brokenHashOnTheWeb = "#{FIXTURES_DIR}/links/brokenHashOnTheWeb.html"
|
|
24
|
-
output = make_bin('--check-external-hash', brokenHashOnTheWeb)
|
|
25
|
-
expect(output).to match('1 failure')
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'works with directory-index-file' do
|
|
29
|
-
link_pointing_to_directory = "#{FIXTURES_DIR}/links/link_pointing_to_directory.html"
|
|
30
|
-
output = make_bin('--directory-index-file index.php', link_pointing_to_directory)
|
|
31
|
-
expect(output).to match('successfully')
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it 'works with disable-external' do
|
|
35
|
-
external = "#{FIXTURES_DIR}/links/brokenLinkExternal.html"
|
|
36
|
-
output = make_bin('--disable-external', external)
|
|
37
|
-
expect(output).to match('successfully')
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'works with ext' do
|
|
41
|
-
external = "#{FIXTURES_DIR}/links/file.foo"
|
|
42
|
-
output = make_bin('--ext .foo', external)
|
|
43
|
-
expect(output).to match('1 failure')
|
|
44
|
-
expect(output).to match('LinkCheck')
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it 'works with file-ignore' do
|
|
48
|
-
external = "#{FIXTURES_DIR}/links/brokenHashInternal.html"
|
|
49
|
-
output = make_bin("--file-ignore #{external}", external)
|
|
50
|
-
expect(output).to match('successfully')
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'works with href-ignore' do
|
|
54
|
-
ignorableLinks = "#{FIXTURES_DIR}/links/ignorableLinksViaOptions.html"
|
|
55
|
-
output = make_bin('--href-ignore /^http:\/\//,/sdadsad/,../whaadadt.html', ignorableLinks)
|
|
56
|
-
expect(output).to match('successfully')
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it 'works with href-swap' do
|
|
60
|
-
translatedLink = "#{FIXTURES_DIR}/links/linkTranslatedViaHrefSwap.html"
|
|
61
|
-
output = make_bin('--href-swap "\A/articles/([\w-]+):\1.html"', translatedLink)
|
|
62
|
-
expect(output).to match('successfully')
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it 'works with only-4xx' do
|
|
66
|
-
brokenHashOnTheWeb = "#{FIXTURES_DIR}/links/brokenHashOnTheWeb.html"
|
|
67
|
-
output = make_bin('--only-4xx', brokenHashOnTheWeb)
|
|
68
|
-
expect(output).to match('successfully')
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it 'works with check-favicon' do
|
|
72
|
-
broken = "#{FIXTURES_DIR}/favicon/favicon_broken.html"
|
|
73
|
-
output = make_bin('--check-favicon', broken)
|
|
74
|
-
expect(output).to match('1 failure')
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it 'works with check-html' do
|
|
78
|
-
broken = "#{FIXTURES_DIR}/html/invalid_tag.html"
|
|
79
|
-
output = make_bin('--check-html', broken)
|
|
80
|
-
expect(output).to match('1 failure')
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
it 'works with empty-alt-ignore' do
|
|
84
|
-
broken = "#{FIXTURES_DIR}/html/emptyImageAltText.html"
|
|
85
|
-
output = make_bin('--empty-alt-ignore', broken)
|
|
86
|
-
expect(output).to match('successfully')
|
|
87
|
-
end
|
|
88
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Favicons test' do
|
|
4
|
-
it 'ignores for absent favicon by default' do
|
|
5
|
-
absent = "#{FIXTURES_DIR}/favicon/favicon_absent.html"
|
|
6
|
-
expect(run_proofer(absent).failed_tests).to eq []
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
it 'fails for absent favicon' do
|
|
10
|
-
absent = "#{FIXTURES_DIR}/favicon/favicon_absent.html"
|
|
11
|
-
proofer = run_proofer(absent, { :check_favicon => true })
|
|
12
|
-
expect(proofer.failed_tests.first).to match(/no favicon specified/)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it 'fails for absent favicon but present apple touch icon' do
|
|
16
|
-
absent = "#{FIXTURES_DIR}/favicon/favicon_absent_apple.html"
|
|
17
|
-
proofer = run_proofer(absent, { :check_favicon => true })
|
|
18
|
-
# Travis gives a different error message here for some reason
|
|
19
|
-
expect(proofer.failed_tests.last).to match(/(internally linking to gpl.png, which does not exist|no favicon specified)/)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'fails for broken favicon' do
|
|
23
|
-
broken = "#{FIXTURES_DIR}/favicon/favicon_broken.html"
|
|
24
|
-
proofer = run_proofer(broken, { :check_favicon => true })
|
|
25
|
-
|
|
26
|
-
expect(proofer.failed_tests.first).to match(/internally linking to asdadaskdalsdk.png/)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it 'passes for present favicon' do
|
|
30
|
-
present = "#{FIXTURES_DIR}/favicon/favicon_present.html"
|
|
31
|
-
proofer = run_proofer(present, { :check_favicon => true })
|
|
32
|
-
expect(proofer.failed_tests).to eq []
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'passes for present favicon with shortcut notation' do
|
|
36
|
-
present = "#{FIXTURES_DIR}/favicon/favicon_present_shortcut.html"
|
|
37
|
-
proofer = run_proofer(present, { :check_favicon => true })
|
|
38
|
-
expect(proofer.failed_tests).to eq []
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it 'fails for broken favicon with data-proofer-ignore' do
|
|
42
|
-
broken_but_ignored = "#{FIXTURES_DIR}/favicon/favicon_broken_but_ignored.html"
|
|
43
|
-
proofer = run_proofer(broken_but_ignored, { :check_favicon => true })
|
|
44
|
-
expect(proofer.failed_tests.first).to match(/no favicon specified/)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
end
|