Class: Nanoc::Extra::Checking::Checks::W3CValidator Private
- Inherits:
-
Nanoc::Extra::Checking::Check
- Object
- Int::Context
- Nanoc::Extra::Checking::Check
- Nanoc::Extra::Checking::Checks::W3CValidator
- Defined in:
- lib/nanoc/extra/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::Extra::Checking::Check
Instance Method Summary collapse
- #extension ⇒ Object private
- #run ⇒ Object private
- #validator_class ⇒ Object private
Methods inherited from Nanoc::Extra::Checking::Check
#add_issue, create, #initialize
Methods included from Int::PluginRegistry::PluginMethods
#all, #identifier, #identifiers, #named, #register
Methods inherited from Int::Context
Constructor Details
This class inherits a constructor from Nanoc::Extra::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.
20 21 22 |
# File 'lib/nanoc/extra/checking/checks/w3c_validator.rb', line 20 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.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nanoc/extra/checking/checks/w3c_validator.rb', line 4 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}: #{message}: #{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.
24 25 26 |
# File 'lib/nanoc/extra/checking/checks/w3c_validator.rb', line 24 def validator_class raise NotImplementedError end |