validate-website 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/validate_website/validator.rb +3 -1
- data/spec/core_spec.rb +1 -1
- data/spec/data/validator.nu-excessive.html +118 -0
- data/spec/validator_spec.rb +19 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0a2d1da5c29498cbe0f4a942cddbad5507b542c
|
4
|
+
data.tar.gz: ddd9190b8e58648b9a198b31624a4071f750fee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de94adbbbb9d323c0d0d1f4c79063d2cd60d0c0c5814928d41b4847ffd8623bbb0991c60b42cc2fd1079a819c46a3fd33b0353de7a4679a6605e349e53d95db9
|
7
|
+
data.tar.gz: 3b9a0fbb9d5fc11c44afbc928f08a6953f782661a4d409effa4bb6c789f289441416ed067ea2141fc7bd8a9011d6fa4381733a3e8e27e86861d2aa1f7fb58ca5
|
@@ -97,7 +97,9 @@ module ValidateWebsite
|
|
97
97
|
'Content-Length' => multipart.to_s.bytesize.to_s,
|
98
98
|
}
|
99
99
|
res = http.start { |con| con.post(url.path, multipart.to_s, headers) }
|
100
|
-
|
100
|
+
validator_document = Nokogiri::HTML(res.body)
|
101
|
+
@errors = validator_document.css('h2.invalid').map(&:content)
|
102
|
+
@errors.concat validator_document.css('ol li.error').map(&:content)
|
101
103
|
end
|
102
104
|
end
|
103
105
|
end
|
data/spec/core_spec.rb
CHANGED
@@ -0,0 +1,118 @@
|
|
1
|
+
<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
|
5
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
W3C Validator - Excessive Use
|
8
|
+
</title>
|
9
|
+
|
10
|
+
<link rev="made" href="mailto:www-validator@w3.org" />
|
11
|
+
|
12
|
+
<link rev="start" href="/" title="Home Page" />
|
13
|
+
|
14
|
+
<style type="text/css" media="all">
|
15
|
+
@import "/style/base";
|
16
|
+
@import "/style/results";
|
17
|
+
</style>
|
18
|
+
|
19
|
+
<style type="text/css">
|
20
|
+
div#result {
|
21
|
+
padding-top: 0;
|
22
|
+
}
|
23
|
+
div#result h2 {
|
24
|
+
line-height: normal }
|
25
|
+
div#result p {
|
26
|
+
margin: 1em 0em;
|
27
|
+
}
|
28
|
+
#vs img {
|
29
|
+
float: left;
|
30
|
+
margin-right: 20px;
|
31
|
+
margin-bottom: 10px;
|
32
|
+
}
|
33
|
+
address {
|
34
|
+
clear: both;
|
35
|
+
margin: 24px 32px 0px;
|
36
|
+
padding: 10px 0;
|
37
|
+
border-top-style: solid;
|
38
|
+
border-width: thin;
|
39
|
+
}
|
40
|
+
</style>
|
41
|
+
</head>
|
42
|
+
|
43
|
+
<body>
|
44
|
+
<div id="banner">
|
45
|
+
<h1 id="title">
|
46
|
+
<a href="http://www.w3.org/">
|
47
|
+
<img alt="W3C" width="110" height="61" id="logo" src="/images/w3c.png" />
|
48
|
+
</a>
|
49
|
+
<a href="/">
|
50
|
+
<span>
|
51
|
+
Markup Validation Service
|
52
|
+
</span>
|
53
|
+
</a>
|
54
|
+
|
55
|
+
</h1>
|
56
|
+
|
57
|
+
<p id="tagline">
|
58
|
+
Check the markup (HTML, XHTML) of Web documents
|
59
|
+
</p>
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<div id="results_container">
|
64
|
+
<div id="result">
|
65
|
+
<h2 id="results" class="invalid">
|
66
|
+
Sorry! This document can not be checked.
|
67
|
+
<br />
|
68
|
+
<strong>
|
69
|
+
We have received excessive Validation requests originating from your IP address
|
70
|
+
</strong>
|
71
|
+
</h2>
|
72
|
+
|
73
|
+
<p>
|
74
|
+
Please use this free service reasonably. Your IP address will be unblocked automatically after some time.
|
75
|
+
</p>
|
76
|
+
|
77
|
+
<p>
|
78
|
+
If you are using a browser plugin that checks every single page you visit, please discontinue using it and only use selectively.
|
79
|
+
</p>
|
80
|
+
|
81
|
+
<p>
|
82
|
+
W3C will continue to increase Validator resources and services and only
|
83
|
+
imposes restrictions to ensure the service remains available to the community.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
<p id="vs">
|
87
|
+
|
88
|
+
<a href="https://validator-suite.w3.org/" title="Check your website with the W3C Validator Suite">
|
89
|
+
<img src="https://validator-suite.w3.org/icons/vs-blue-256.png" alt="W3C Validator Suite" />
|
90
|
+
</a>
|
91
|
+
If you need more extensive validation services beyond what our free Validator service can accommodate, please consider our premium service,
|
92
|
+
<a href="https://validator-suite.w3.org/">
|
93
|
+
W3C Validator Suite
|
94
|
+
</a>
|
95
|
+
.
|
96
|
+
</p>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
<!-- result -->
|
100
|
+
|
101
|
+
</div>
|
102
|
+
<!-- results_container -->
|
103
|
+
|
104
|
+
<address>
|
105
|
+
|
106
|
+
<a href="http://validator.w3.org/check?uri=referer">
|
107
|
+
<img src="http://www.w3.org/Icons/valid-xhtml10" height="31" width="88" alt="Valid XHTML 1.0!" />
|
108
|
+
</a>
|
109
|
+
|
110
|
+
<a title="Send Feedback for the W3C Markup Validation Service" href="/feedback.html">
|
111
|
+
The W3C Validator Team
|
112
|
+
</a>
|
113
|
+
<br />
|
114
|
+
|
115
|
+
</address>
|
116
|
+
|
117
|
+
</body>
|
118
|
+
</html>
|
data/spec/validator_spec.rb
CHANGED
@@ -83,6 +83,25 @@ describe ValidateWebsite::Validator do
|
|
83
83
|
validator.errors.size.must_equal 36
|
84
84
|
end
|
85
85
|
end
|
86
|
+
|
87
|
+
describe('excessive') do
|
88
|
+
before do
|
89
|
+
validator_res = File.join('spec', 'data', 'validator.nu-excessive.html')
|
90
|
+
stub_request(:any, ValidateWebsite::Validator::HTML5_VALIDATOR_SERVICE)
|
91
|
+
.to_return(body: open(validator_res).read)
|
92
|
+
end
|
93
|
+
it "html5 should have errors" do
|
94
|
+
name = 'html5'
|
95
|
+
file = File.join('spec', 'data', "#{name}.html")
|
96
|
+
page = FakePage.new(name,
|
97
|
+
body: open(file).read,
|
98
|
+
content_type: 'text/html')
|
99
|
+
@html5_page = @http.get_page(page.url)
|
100
|
+
validator = ValidateWebsite::Validator.new(@html5_page.doc,
|
101
|
+
@html5_page.body)
|
102
|
+
validator.valid?.must_equal false
|
103
|
+
end
|
104
|
+
end
|
86
105
|
end
|
87
106
|
|
88
107
|
describe('html4') do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validate-website
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Arnoud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spidr
|
@@ -239,6 +239,7 @@ files:
|
|
239
239
|
- spec/data/html5-linuxfr.html
|
240
240
|
- spec/data/html5.html
|
241
241
|
- spec/data/news/ryzom-naissance-du-projet-libre-ryzom-forge.md
|
242
|
+
- spec/data/validator.nu-excessive.html
|
242
243
|
- spec/data/validator.nu-failure.html
|
243
244
|
- spec/data/validator.nu-success.html
|
244
245
|
- spec/data/xhtml1-strict.html
|