validate-website 0.5.7 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/README.rdoc +5 -4
  2. data/Rakefile +3 -3
  3. data/bin/validate-website +9 -11
  4. data/bin/validate-website-static +7 -18
  5. data/lib/validate_website.rb +1 -210
  6. data/lib/validate_website/colorful_messages.rb +28 -0
  7. data/lib/validate_website/core.rb +141 -0
  8. data/lib/validate_website/option_parser.rb +133 -0
  9. data/lib/validate_website/runner.rb +35 -0
  10. data/lib/validate_website/validator.rb +69 -0
  11. data/man/man1/validate-website-static.1 +82 -0
  12. data/{lib/xhtml → share/schemas}/frameset.dtd +0 -0
  13. data/{lib/xhtml → share/schemas}/loose.dtd +0 -0
  14. data/{lib/xhtml → share/schemas}/strict.dtd +0 -0
  15. data/{lib/xhtml → share/schemas}/xframes-1.xsd +0 -0
  16. data/{lib/xhtml → share/schemas}/xhtml-access-1.xsd +0 -0
  17. data/{lib/xhtml → share/schemas}/xhtml-applet-1.xsd +0 -0
  18. data/{lib/xhtml → share/schemas}/xhtml-attribs-1.xsd +0 -0
  19. data/{lib/xhtml → share/schemas}/xhtml-base-1.xsd +0 -0
  20. data/{lib/xhtml → share/schemas}/xhtml-basic-form-1.xsd +0 -0
  21. data/{lib/xhtml → share/schemas}/xhtml-basic-table-1.xsd +0 -0
  22. data/{lib/xhtml → share/schemas}/xhtml-basic10-model-1.xsd +0 -0
  23. data/{lib/xhtml → share/schemas}/xhtml-basic10-module-redefines-1.xsd +0 -0
  24. data/{lib/xhtml → share/schemas}/xhtml-basic10-modules-1.xsd +0 -0
  25. data/{lib/xhtml → share/schemas}/xhtml-basic10.xsd +0 -0
  26. data/{lib/xhtml → share/schemas}/xhtml-basic11-model-1.xsd +0 -0
  27. data/{lib/xhtml → share/schemas}/xhtml-basic11-modules-1.xsd +0 -0
  28. data/{lib/xhtml → share/schemas}/xhtml-basic11.dtd +0 -0
  29. data/{lib/xhtml → share/schemas}/xhtml-basic11.xsd +0 -0
  30. data/{lib/xhtml → share/schemas}/xhtml-bdo-1.xsd +0 -0
  31. data/{lib/xhtml → share/schemas}/xhtml-blkphras-1.xsd +0 -0
  32. data/{lib/xhtml → share/schemas}/xhtml-blkpres-1.xsd +0 -0
  33. data/{lib/xhtml → share/schemas}/xhtml-blkstruct-1.xsd +0 -0
  34. data/{lib/xhtml → share/schemas}/xhtml-charent-1.xsd +0 -0
  35. data/{lib/xhtml → share/schemas}/xhtml-copyright-1.xsd +0 -0
  36. data/{lib/xhtml → share/schemas}/xhtml-csismap-1.xsd +0 -0
  37. data/{lib/xhtml → share/schemas}/xhtml-datatypes-1.xsd +0 -0
  38. data/{lib/xhtml → share/schemas}/xhtml-edit-1.xsd +0 -0
  39. data/{lib/xhtml → share/schemas}/xhtml-events-1.xsd +0 -0
  40. data/{lib/xhtml → share/schemas}/xhtml-form-1.xsd +0 -0
  41. data/{lib/xhtml → share/schemas}/xhtml-frames-1.xsd +0 -0
  42. data/{lib/xhtml → share/schemas}/xhtml-framework-1.xsd +0 -0
  43. data/{lib/xhtml → share/schemas}/xhtml-hypertext-1.xsd +0 -0
  44. data/{lib/xhtml → share/schemas}/xhtml-iframe-1.xsd +0 -0
  45. data/{lib/xhtml → share/schemas}/xhtml-image-1.xsd +0 -0
  46. data/{lib/xhtml → share/schemas}/xhtml-inlphras-1.xsd +0 -0
  47. data/{lib/xhtml → share/schemas}/xhtml-inlpres-1.xsd +0 -0
  48. data/{lib/xhtml → share/schemas}/xhtml-inlstruct-1.xsd +0 -0
  49. data/{lib/xhtml → share/schemas}/xhtml-inlstyle-1.xsd +0 -0
  50. data/{lib/xhtml → share/schemas}/xhtml-inputmode-1.xsd +0 -0
  51. data/{lib/xhtml → share/schemas}/xhtml-lat1.ent +0 -0
  52. data/{lib/xhtml → share/schemas}/xhtml-legacy-1.xsd +0 -0
  53. data/{lib/xhtml → share/schemas}/xhtml-link-1.xsd +0 -0
  54. data/{lib/xhtml → share/schemas}/xhtml-list-1.xsd +0 -0
  55. data/{lib/xhtml → share/schemas}/xhtml-meta-1.xsd +0 -0
  56. data/{lib/xhtml → share/schemas}/xhtml-metaAttributes-1.xsd +0 -0
  57. data/{lib/xhtml → share/schemas}/xhtml-misc-1.xsd +0 -0
  58. data/{lib/xhtml → share/schemas}/xhtml-nameident-1.xsd +0 -0
  59. data/{lib/xhtml → share/schemas}/xhtml-notations-1.xsd +0 -0
  60. data/{lib/xhtml → share/schemas}/xhtml-object-1.xsd +0 -0
  61. data/{lib/xhtml → share/schemas}/xhtml-param-1.xsd +0 -0
  62. data/{lib/xhtml → share/schemas}/xhtml-pres-1.xsd +0 -0
  63. data/{lib/xhtml → share/schemas}/xhtml-print-1.xsd +0 -0
  64. data/{lib/xhtml → share/schemas}/xhtml-print-model-1.xsd +0 -0
  65. data/{lib/xhtml → share/schemas}/xhtml-print-modules-1.xsd +0 -0
  66. data/{lib/xhtml → share/schemas}/xhtml-rdfa-1.dtd +0 -0
  67. data/{lib/xhtml → share/schemas}/xhtml-rdfa-1.xsd +0 -0
  68. data/{lib/xhtml → share/schemas}/xhtml-rdfa-model-1.xsd +0 -0
  69. data/{lib/xhtml → share/schemas}/xhtml-rdfa-modules-1.xsd +0 -0
  70. data/{lib/xhtml → share/schemas}/xhtml-ruby-1.xsd +0 -0
  71. data/{lib/xhtml → share/schemas}/xhtml-ruby-basic-1.xsd +0 -0
  72. data/{lib/xhtml → share/schemas}/xhtml-script-1.xsd +0 -0
  73. data/{lib/xhtml → share/schemas}/xhtml-special.ent +0 -0
  74. data/{lib/xhtml → share/schemas}/xhtml-ssismap-1.xsd +0 -0
  75. data/{lib/xhtml → share/schemas}/xhtml-struct-1.xsd +0 -0
  76. data/{lib/xhtml → share/schemas}/xhtml-style-1.xsd +0 -0
  77. data/{lib/xhtml → share/schemas}/xhtml-symbol.ent +0 -0
  78. data/{lib/xhtml → share/schemas}/xhtml-table-1.xsd +0 -0
  79. data/{lib/xhtml → share/schemas}/xhtml-target-1.xsd +0 -0
  80. data/{lib/xhtml → share/schemas}/xhtml-text-1.xsd +0 -0
  81. data/{lib/xhtml → share/schemas}/xhtml1-frameset.dtd +0 -0
  82. data/{lib/xhtml → share/schemas}/xhtml1-frameset.xsd +0 -0
  83. data/{lib/xhtml → share/schemas}/xhtml1-strict.dtd +0 -0
  84. data/{lib/xhtml → share/schemas}/xhtml1-strict.xsd +0 -0
  85. data/{lib/xhtml → share/schemas}/xhtml1-transitional.dtd +0 -0
  86. data/{lib/xhtml → share/schemas}/xhtml1-transitional.xsd +0 -0
  87. data/{lib/xhtml → share/schemas}/xhtml11-model-1.xsd +0 -0
  88. data/{lib/xhtml → share/schemas}/xhtml11-module-redefines-1.xsd +0 -0
  89. data/{lib/xhtml → share/schemas}/xhtml11-modules-1.xsd +0 -0
  90. data/{lib/xhtml → share/schemas}/xhtml11.xsd +0 -0
  91. data/{lib/xhtml → share/schemas}/xhtml2.xsd +0 -0
  92. data/{lib/xhtml → share/schemas}/xml-events-1.xsd +0 -0
  93. data/{lib/xhtml → share/schemas}/xml-events-2.xsd +0 -0
  94. data/{lib/xhtml → share/schemas}/xml-events-attribs-1.xsd +0 -0
  95. data/{lib/xhtml → share/schemas}/xml-events-attribs-2.xsd +0 -0
  96. data/{lib/xhtml → share/schemas}/xml-events-copyright-1.xsd +0 -0
  97. data/{lib/xhtml → share/schemas}/xml-events-copyright-2.xsd +0 -0
  98. data/{lib/xhtml → share/schemas}/xml-handlers-1.xsd +0 -0
  99. data/{lib/xhtml → share/schemas}/xml-handlers-2.xsd +0 -0
  100. data/{lib/xhtml → share/schemas}/xml-script-1.xsd +0 -0
  101. data/{lib/xhtml → share/schemas}/xml.xsd +0 -0
  102. data/spec/core_spec.rb +56 -0
  103. data/spec/spec_helper.rb +1 -1
  104. data/spec/validator_spec.rb +3 -1
  105. metadata +102 -99
  106. data/lib/colorful_messages.rb +0 -28
  107. data/lib/validator.rb +0 -67
  108. data/spec/data/index.cs.html +0 -243
  109. data/spec/validate_website_spec.rb +0 -54
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/spec/core_spec.rb ADDED
@@ -0,0 +1,56 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
+
3
+ module ValidateWebsite
4
+ describe Core do
5
+
6
+ before(:each) do
7
+ FakeWeb.clean_registry
8
+ @validate_website = ValidateWebsite::Core.new
9
+ end
10
+
11
+ context('html') do
12
+ it "should extract url" do
13
+ name = 'xhtml1-strict'
14
+ file = File.join('spec', 'data', "#{name}.html")
15
+ page = FakePage.new(name,
16
+ :body => open(file).read,
17
+ :content_type => 'text/html')
18
+ @validate_website.site = page.url
19
+ @validate_website.crawl(:quiet => true)
20
+ @validate_website.anemone.should have(3).pages
21
+ end
22
+ end
23
+
24
+ context('css') do
25
+ it "should crawl css and extract url" do
26
+ page = FakePage.new('test.css',
27
+ :body => ".test {background-image: url(pouet);}
28
+ .tests {background-image: url(/image/pouet.png)}
29
+ .tests {background-image: url(/image/pouet_42.png)}
30
+ .tests {background-image: url(/image/pouet)}",
31
+ :content_type => 'text/css')
32
+ @validate_website.site = page.url
33
+ @validate_website.crawl
34
+ @validate_website.anemone.should have(5).pages
35
+ end
36
+
37
+ it "should extract url with single quote" do
38
+ page = FakePage.new('test.css',
39
+ :body => ".test {background-image: url('pouet');}",
40
+ :content_type => 'text/css')
41
+ @validate_website.site = page.url
42
+ @validate_website.crawl
43
+ @validate_website.anemone.should have(2).pages
44
+ end
45
+
46
+ it "should extract url with double quote" do
47
+ page = FakePage.new('test.css',
48
+ :body => ".test {background-image: url(\"pouet\");}",
49
+ :content_type => 'text/css')
50
+ @validate_website.site = page.url
51
+ @validate_website.crawl
52
+ @validate_website.anemone.should have(2).pages
53
+ end
54
+ end
55
+ end
56
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,6 @@ require 'anemone'
4
4
  lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
5
5
  $:.unshift(File.expand_path(lib_dir))
6
6
 
7
- require 'validate_website'
7
+ require 'validate_website/core'
8
8
 
9
9
  SPEC_DOMAIN = 'http://www.example.com/'
@@ -1,6 +1,7 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
2
 
3
- describe Validator do
3
+ module ValidateWebsite
4
+ describe Validator do
4
5
  before(:each) do
5
6
  FakeWeb.clean_registry
6
7
  @http = Anemone::HTTP.new
@@ -63,4 +64,5 @@ describe Validator do
63
64
  validator.should be_valid
64
65
  end
65
66
  end
67
+ end
66
68
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate-website
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 7
10
- version: 0.5.7
8
+ - 6
9
+ - 0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Laurent Arnoud
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-10 00:00:00 +01:00
18
+ date: 2010-12-26 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -96,109 +96,112 @@ files:
96
96
  - LICENSE
97
97
  - bin/validate-website-static
98
98
  - bin/validate-website
99
- - lib/validator.rb
100
- - lib/colorful_messages.rb
101
- - lib/xhtml/xhtml-blkphras-1.xsd
102
- - lib/xhtml/xhtml1-transitional.xsd
103
- - lib/xhtml/xhtml1-strict.xsd
104
- - lib/xhtml/xhtml-blkstruct-1.xsd
105
- - lib/xhtml/xhtml11-modules-1.xsd
106
- - lib/xhtml/xhtml-blkpres-1.xsd
107
- - lib/xhtml/xhtml-basic11.dtd
108
- - lib/xhtml/xhtml-inlpres-1.xsd
109
- - lib/xhtml/xhtml-inlphras-1.xsd
110
- - lib/xhtml/xhtml-misc-1.xsd
111
- - lib/xhtml/xhtml-symbol.ent
112
- - lib/xhtml/xhtml1-frameset.xsd
113
- - lib/xhtml/xhtml-meta-1.xsd
114
- - lib/xhtml/xhtml1-frameset.dtd
115
- - lib/xhtml/xml-events-copyright-2.xsd
116
- - lib/xhtml/xml-handlers-2.xsd
117
- - lib/xhtml/xhtml-object-1.xsd
118
- - lib/xhtml/xhtml-bdo-1.xsd
119
- - lib/xhtml/frameset.dtd
120
- - lib/xhtml/xml-events-1.xsd
121
- - lib/xhtml/loose.dtd
122
- - lib/xhtml/xhtml-basic10-model-1.xsd
123
- - lib/xhtml/xhtml-table-1.xsd
124
- - lib/xhtml/xhtml2.xsd
125
- - lib/xhtml/xhtml-print-model-1.xsd
126
- - lib/xhtml/xhtml-rdfa-1.xsd
127
- - lib/xhtml/xhtml-basic-form-1.xsd
128
- - lib/xhtml/xhtml-inputmode-1.xsd
129
- - lib/xhtml/xhtml-ssismap-1.xsd
130
- - lib/xhtml/xhtml-basic10-modules-1.xsd
131
- - lib/xhtml/xhtml-events-1.xsd
132
- - lib/xhtml/xhtml-form-1.xsd
133
- - lib/xhtml/xhtml-struct-1.xsd
134
- - lib/xhtml/xml-script-1.xsd
135
- - lib/xhtml/xhtml-print-modules-1.xsd
136
- - lib/xhtml/xhtml-basic10.xsd
137
- - lib/xhtml/xframes-1.xsd
138
- - lib/xhtml/xhtml-rdfa-1.dtd
139
- - lib/xhtml/xhtml-datatypes-1.xsd
140
- - lib/xhtml/xhtml-pres-1.xsd
141
- - lib/xhtml/xhtml-charent-1.xsd
142
- - lib/xhtml/xhtml1-transitional.dtd
143
- - lib/xhtml/xhtml-access-1.xsd
144
- - lib/xhtml/xhtml-target-1.xsd
145
- - lib/xhtml/xhtml-param-1.xsd
146
- - lib/xhtml/xhtml-special.ent
147
- - lib/xhtml/xhtml-legacy-1.xsd
148
- - lib/xhtml/xhtml-frames-1.xsd
149
- - lib/xhtml/xhtml11-model-1.xsd
150
- - lib/xhtml/xhtml-inlstyle-1.xsd
151
- - lib/xhtml/xhtml-text-1.xsd
152
- - lib/xhtml/xhtml1-strict.dtd
153
- - lib/xhtml/xhtml-list-1.xsd
154
- - lib/xhtml/xhtml-framework-1.xsd
155
- - lib/xhtml/xml-events-copyright-1.xsd
156
- - lib/xhtml/xhtml-print-1.xsd
157
- - lib/xhtml/xml-events-2.xsd
158
- - lib/xhtml/xhtml-applet-1.xsd
159
- - lib/xhtml/xhtml-style-1.xsd
160
- - lib/xhtml/xhtml-base-1.xsd
161
- - lib/xhtml/xhtml-nameident-1.xsd
162
- - lib/xhtml/xhtml-iframe-1.xsd
163
- - lib/xhtml/xhtml-inlstruct-1.xsd
164
- - lib/xhtml/xhtml-notations-1.xsd
165
- - lib/xhtml/xhtml11-module-redefines-1.xsd
166
- - lib/xhtml/xhtml-basic11-modules-1.xsd
167
- - lib/xhtml/xml-events-attribs-2.xsd
168
- - lib/xhtml/xhtml-rdfa-model-1.xsd
169
- - lib/xhtml/xhtml-script-1.xsd
170
- - lib/xhtml/xhtml-hypertext-1.xsd
171
- - lib/xhtml/xhtml-rdfa-modules-1.xsd
172
- - lib/xhtml/xhtml-image-1.xsd
173
- - lib/xhtml/xml.xsd
174
- - lib/xhtml/xhtml-ruby-basic-1.xsd
175
- - lib/xhtml/xhtml-basic11.xsd
176
- - lib/xhtml/xml-handlers-1.xsd
177
- - lib/xhtml/xml-events-attribs-1.xsd
178
- - lib/xhtml/xhtml-link-1.xsd
179
- - lib/xhtml/xhtml-metaAttributes-1.xsd
180
- - lib/xhtml/xhtml-basic-table-1.xsd
181
- - lib/xhtml/xhtml-csismap-1.xsd
182
- - lib/xhtml/xhtml-basic11-model-1.xsd
183
- - lib/xhtml/xhtml-copyright-1.xsd
184
- - lib/xhtml/xhtml-basic10-module-redefines-1.xsd
185
- - lib/xhtml/strict.dtd
186
- - lib/xhtml/xhtml-edit-1.xsd
187
- - lib/xhtml/xhtml11.xsd
188
- - lib/xhtml/xhtml-lat1.ent
189
- - lib/xhtml/xhtml-attribs-1.xsd
190
- - lib/xhtml/xhtml-ruby-1.xsd
99
+ - lib/validate_website/validator.rb
100
+ - lib/validate_website/runner.rb
101
+ - lib/validate_website/core.rb
102
+ - lib/validate_website/colorful_messages.rb
103
+ - lib/validate_website/option_parser.rb
191
104
  - lib/validate_website.rb
105
+ - man/man1/validate-website-static.1
192
106
  - man/man1/validate-website.1
193
107
  - spec/validator_spec.rb
108
+ - spec/core_spec.rb
194
109
  - spec/spec_helper.rb
195
110
  - spec/data/html5-linuxfr.html
196
- - spec/data/index.cs.html
197
111
  - spec/data/html4-strict.html
198
112
  - spec/data/html5.html
199
113
  - spec/data/xhtml1-strict.html
200
114
  - spec/fakeweb_helper.rb
201
- - spec/validate_website_spec.rb
115
+ - share/schemas/xhtml-blkphras-1.xsd
116
+ - share/schemas/xhtml1-transitional.xsd
117
+ - share/schemas/xhtml1-strict.xsd
118
+ - share/schemas/xhtml-blkstruct-1.xsd
119
+ - share/schemas/xhtml11-modules-1.xsd
120
+ - share/schemas/xhtml-blkpres-1.xsd
121
+ - share/schemas/xhtml-basic11.dtd
122
+ - share/schemas/xhtml-inlpres-1.xsd
123
+ - share/schemas/xhtml-inlphras-1.xsd
124
+ - share/schemas/xhtml-misc-1.xsd
125
+ - share/schemas/xhtml-symbol.ent
126
+ - share/schemas/xhtml1-frameset.xsd
127
+ - share/schemas/xhtml-meta-1.xsd
128
+ - share/schemas/xhtml1-frameset.dtd
129
+ - share/schemas/xml-events-copyright-2.xsd
130
+ - share/schemas/xml-handlers-2.xsd
131
+ - share/schemas/xhtml-object-1.xsd
132
+ - share/schemas/xhtml-bdo-1.xsd
133
+ - share/schemas/frameset.dtd
134
+ - share/schemas/xml-events-1.xsd
135
+ - share/schemas/loose.dtd
136
+ - share/schemas/xhtml-basic10-model-1.xsd
137
+ - share/schemas/xhtml-table-1.xsd
138
+ - share/schemas/xhtml2.xsd
139
+ - share/schemas/xhtml-print-model-1.xsd
140
+ - share/schemas/xhtml-rdfa-1.xsd
141
+ - share/schemas/xhtml-basic-form-1.xsd
142
+ - share/schemas/xhtml-inputmode-1.xsd
143
+ - share/schemas/xhtml-ssismap-1.xsd
144
+ - share/schemas/xhtml-basic10-modules-1.xsd
145
+ - share/schemas/xhtml-events-1.xsd
146
+ - share/schemas/xhtml-form-1.xsd
147
+ - share/schemas/xhtml-struct-1.xsd
148
+ - share/schemas/xml-script-1.xsd
149
+ - share/schemas/xhtml-print-modules-1.xsd
150
+ - share/schemas/xhtml-basic10.xsd
151
+ - share/schemas/xframes-1.xsd
152
+ - share/schemas/xhtml-rdfa-1.dtd
153
+ - share/schemas/xhtml-datatypes-1.xsd
154
+ - share/schemas/xhtml-pres-1.xsd
155
+ - share/schemas/xhtml-charent-1.xsd
156
+ - share/schemas/xhtml1-transitional.dtd
157
+ - share/schemas/xhtml-access-1.xsd
158
+ - share/schemas/xhtml-target-1.xsd
159
+ - share/schemas/xhtml-param-1.xsd
160
+ - share/schemas/xhtml-special.ent
161
+ - share/schemas/xhtml-legacy-1.xsd
162
+ - share/schemas/xhtml-frames-1.xsd
163
+ - share/schemas/xhtml11-model-1.xsd
164
+ - share/schemas/xhtml-inlstyle-1.xsd
165
+ - share/schemas/xhtml-text-1.xsd
166
+ - share/schemas/xhtml1-strict.dtd
167
+ - share/schemas/xhtml-list-1.xsd
168
+ - share/schemas/xhtml-framework-1.xsd
169
+ - share/schemas/xml-events-copyright-1.xsd
170
+ - share/schemas/xhtml-print-1.xsd
171
+ - share/schemas/xml-events-2.xsd
172
+ - share/schemas/xhtml-applet-1.xsd
173
+ - share/schemas/xhtml-style-1.xsd
174
+ - share/schemas/xhtml-base-1.xsd
175
+ - share/schemas/xhtml-nameident-1.xsd
176
+ - share/schemas/xhtml-iframe-1.xsd
177
+ - share/schemas/xhtml-inlstruct-1.xsd
178
+ - share/schemas/xhtml-notations-1.xsd
179
+ - share/schemas/xhtml11-module-redefines-1.xsd
180
+ - share/schemas/xhtml-basic11-modules-1.xsd
181
+ - share/schemas/xml-events-attribs-2.xsd
182
+ - share/schemas/xhtml-rdfa-model-1.xsd
183
+ - share/schemas/xhtml-script-1.xsd
184
+ - share/schemas/xhtml-hypertext-1.xsd
185
+ - share/schemas/xhtml-rdfa-modules-1.xsd
186
+ - share/schemas/xhtml-image-1.xsd
187
+ - share/schemas/xml.xsd
188
+ - share/schemas/xhtml-ruby-basic-1.xsd
189
+ - share/schemas/xhtml-basic11.xsd
190
+ - share/schemas/xml-handlers-1.xsd
191
+ - share/schemas/xml-events-attribs-1.xsd
192
+ - share/schemas/xhtml-link-1.xsd
193
+ - share/schemas/xhtml-metaAttributes-1.xsd
194
+ - share/schemas/xhtml-basic-table-1.xsd
195
+ - share/schemas/xhtml-csismap-1.xsd
196
+ - share/schemas/xhtml-basic11-model-1.xsd
197
+ - share/schemas/xhtml-copyright-1.xsd
198
+ - share/schemas/xhtml-basic10-module-redefines-1.xsd
199
+ - share/schemas/strict.dtd
200
+ - share/schemas/xhtml-edit-1.xsd
201
+ - share/schemas/xhtml11.xsd
202
+ - share/schemas/xhtml-lat1.ent
203
+ - share/schemas/xhtml-attribs-1.xsd
204
+ - share/schemas/xhtml-ruby-1.xsd
202
205
  has_rdoc: true
203
206
  homepage: http://github.com/spk/validate-website
204
207
  licenses: []
@@ -1,28 +0,0 @@
1
- # encoding: utf-8
2
- require 'rainbow'
3
-
4
- module ColorfulMessages
5
-
6
- def error(message)
7
- message.to_s.foreground(:red)
8
- end
9
-
10
- def warning(message)
11
- message.to_s.foreground(:yellow)
12
- end
13
-
14
- def success(message)
15
- message.to_s.foreground(:green)
16
- end
17
-
18
- alias_method :message, :success
19
-
20
- def note(message)
21
- message.to_s.foreground(:magenta)
22
- end
23
-
24
- def info(message)
25
- message.to_s.foreground(:blue)
26
- end
27
-
28
- end
data/lib/validator.rb DELETED
@@ -1,67 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class Validator
4
- XHTML_PATH = File.join(File.dirname(__FILE__), '..', 'lib', 'xhtml')
5
-
6
- attr_reader :original_doc, :body, :dtd, :doc, :namespace, :xsd, :errors
7
-
8
- def initialize(original_doc, body)
9
- @original_doc = original_doc
10
- @body = body
11
- @dtd = @original_doc.internal_subset
12
- init_namespace(@dtd)
13
- @errors = []
14
- @errors << 'Unknown document' if @namespace.nil?
15
-
16
- if @errors.empty?
17
- if @dtd_uri && @body.match(@dtd_uri.to_s)
18
- document = @body.sub(@dtd_uri.to_s, @namespace + '.dtd')
19
- else
20
- document = @body
21
- end
22
- @doc = Dir.chdir(XHTML_PATH) do
23
- Nokogiri::XML(document) { |cfg|
24
- cfg.noent.dtdload.dtdvalid
25
- }
26
- end
27
-
28
- # http://www.w3.org/TR/xhtml1-schema/
29
- @xsd = Dir.chdir(XHTML_PATH) do
30
- if File.exists?(@namespace + '.xsd')
31
- Nokogiri::XML::Schema(File.read(@namespace + '.xsd'))
32
- end
33
- end
34
-
35
- if @xsd
36
- # have the xsd so use it
37
- @errors = @xsd.validate(@doc)
38
- else
39
- # dont have xsd fall back to dtd
40
- @doc = Dir.chdir(XHTML_PATH) do
41
- Nokogiri::HTML.parse(document)
42
- end
43
- @errors = @doc.errors
44
- end
45
- end
46
-
47
- rescue Nokogiri::XML::SyntaxError => e
48
- # http://nokogiri.org/tutorials/ensuring_well_formed_markup.html
49
- @errors << e
50
- end
51
-
52
- def valid?
53
- @errors.length == 0
54
- end
55
-
56
- private
57
- def init_namespace(dtd)
58
- if dtd.system_id
59
- dtd_uri = URI.parse(dtd.system_id)
60
- if dtd.system_id && dtd_uri.path
61
- @dtd_uri = dtd_uri
62
- # http://www.w3.org/TR/xhtml1/#dtds
63
- @namespace = File.basename(@dtd_uri.path, '.dtd')
64
- end
65
- end
66
- end
67
- end