Class: Nanoc::Extra::Checking::Checks::HTML

Inherits:
Nanoc::Extra::Checking::Check show all
Defined in:
lib/nanoc/extra/checking/checks/html.rb

Instance Attribute Summary

Attributes inherited from Nanoc::Extra::Checking::Check

#issues, #site

Instance Method Summary (collapse)

Methods inherited from Nanoc::Extra::Checking::Check

#add_issue, #initialize, #output_filenames

Methods included from PluginRegistry::PluginMethods

#all, #identifier, #identifiers, #named, #register

Constructor Details

This class inherits a constructor from Nanoc::Extra::Checking::Check

Instance Method Details

- (Object) run



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/nanoc/extra/checking/checks/html.rb', line 9

def run
  require 'w3c_validators'

  Dir[site.config[:output_dir] + '/**/*.{htm,html}'].each do |filename|
    results = ::W3CValidators::MarkupValidator.new.validate_file(filename)
    results.errors.each do |e|
      desc = e.message.gsub(%r{\s+}, ' ').strip
      add_issue(desc, :subject => filename)
    end
  end
end