Class: YMDP::Validator::HTML
- Inherits:
-
Base
show all
- Defined in:
- lib/ymdp/validator/validator.rb
Class Method Summary
collapse
Methods inherited from Base
#base_path, base_path, #configuration, configuration, configure, #content_variables, display_path, #display_path, #paths, #servers
Class Method Details
.validate(path) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ymdp/validator/validator.rb', line 17
def validate(path)
$stdout.print " #{path} validating . . . "
doctype = configuration.validate["html"]["doctype"]
validator.set_doctype!(doctype)
results = validator.validate_file(path)
valid = results.errors.length <= 0
if valid
$stdout.puts "OK"
else
$stdout.puts "validation errors"
results.errors.each do |err|
$stdout.puts
$stdout.puts err.to_s
end
end
valid
end
|
.validator ⇒ Object
13
14
15
|
# File 'lib/ymdp/validator/validator.rb', line 13
def validator
@validator ||= W3CValidators::MarkupValidator.new
end
|