Sha256: 924aea8acda64c247452451440addb55e3d2caf9ba51ab0b0f54370cdf39ab08

Contents?: true

Size: 685 Bytes

Versions: 19

Compression:

Stored size: 685 Bytes

Contents

module ::Nanoc::Extra::Checking::Checks
  # @api private
  class HTML < ::Nanoc::Extra::Checking::Check
    identifier :html

    def run
      require 'w3c_validators'

      Dir[@config[:output_dir] + '/**/*.{htm,html}'].each do |filename|
        results = ::W3CValidators::MarkupValidator.new.validate_file(filename)
        lines = File.readlines(filename)
        results.errors.each do |e|
          line_num = e.line.to_i - 1
          line = lines[line_num]
          message = e.message.gsub(%r{\s+}, ' ').strip.sub(/\s+:$/, '')
          desc = "line #{line_num + 1}: #{message}: #{line}"
          add_issue(desc, subject: filename)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
nanoc-4.1.6 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.5 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.4 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.3 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.2 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.1 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.0 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.0rc2 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.0rc1 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.0b1 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.1.0a1 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.0.2 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.0.1 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.0.0 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.0.0rc3 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.0.0rc2 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.0.0rc1 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.0.0b4 lib/nanoc/extra/checking/checks/html.rb
nanoc-4.0.0b3 lib/nanoc/extra/checking/checks/html.rb