require 'simplabs/excellent/formatters/base' module Simplabs module Excellent module Formatters class Html < Base #:nodoc: def initialize(stream = $stdout) super end def start @stream.write(HEADER_TEMPLATE) end def file(filename) @stream.write(START_FIlE_TAMPLATE.sub('{{filename}}', filename)) yield self @stream.write(END_FIlE_TAMPLATE) end def warning(warning) @stream.write(WARNING_TEMPLATE.sub('{{line_number}}', warning.line_number.to_s).sub('{{message}}', warning.message)) end def end @stream.write(FOOTER_TEMPLATE) end HEADER_TEMPLATE = <<-END Excellent result
END START_FIlE_TAMPLATE = <<-END
{{filename}}
END END_FIlE_TAMPLATE = <<-END
END WARNING_TEMPLATE = <<-END
Line {{line_number}}{{message}}
END FOOTER_TEMPLATE = <<-END
END end end end end