Class: Nanoc::Checking::Checks::W3CValidator Private
- Inherits:
-
Nanoc::Checking::Check
- Object
- Nanoc::Core::Context
- Nanoc::Checking::Check
- Nanoc::Checking::Checks::W3CValidator
- Defined in:
- lib/nanoc/checking/checks/w3c_validator.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary
Attributes inherited from Nanoc::Checking::Check
Instance Method Summary collapse
- #extension ⇒ Object private
- #run ⇒ Object private
- #validator_class ⇒ Object private
Methods inherited from Nanoc::Checking::Check
#add_issue, create, define, #excluded_patterns, #initialize, #output_filenames, #output_html_filenames
Constructor Details
This class inherits a constructor from Nanoc::Checking::Check
Instance Method Details
#extension ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/nanoc/checking/checks/w3c_validator.rb', line 24 def extension raise NotImplementedError end |
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nanoc/checking/checks/w3c_validator.rb', line 8 def run require 'w3c_validators' Dir[@config.output_dir + '/**/*.' + extension].each do |filename| results = validator_class.new.validate_file(filename) lines = File.readlines(filename) results.errors.each do |e| line_num = e.line.to_i - 1 line = lines[line_num] = e..gsub(%r{\s+}, ' ').strip.sub(/\s+:$/, '') desc = "line #{line_num + 1}: #{}: #{line}" add_issue(desc, subject: filename) end end end |
#validator_class ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/nanoc/checking/checks/w3c_validator.rb', line 28 def validator_class raise NotImplementedError end |