Sha256: ae74d368325a008ad28dbee6e2ee9f9b1336f108278f59d88f69a13de2b8a867
Contents?: true
Size: 934 Bytes
Versions: 3
Compression:
Stored size: 934 Bytes
Contents
require 'nokogiri' require 'html/proofer/checks' module HTML class Proofer def initialize(src, opts={}) @srcDir = src @options = {:ext => ".html"}.merge(opts) end def run get_checks.each do |klass| issues = [] puts "Running #{klass.name.split(/:/).pop()} check... \n\n" Find.find(@srcDir) do |path| if File.extname(path) == @options[:ext] html = HTML::Proofer.create_nokogiri(path) check = klass.new(path, html, @options) check.run self.print_issues(check.issues) end end end end def self.create_nokogiri(path) Nokogiri::HTML(File.read(path)) end def get_checks HTML::Proofer::Checks::Check.subclasses end def print_issues(issues) return if issues.empty? issues.each do |issue| $stderr.puts issue + "\n\n" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
html-proofer-0.0.5 | lib/html/proofer.rb |
html-proofer-0.0.4 | lib/html/proofer.rb |
html-proofer-0.0.3 | lib/html/proofer.rb |