Module: HtmlBeautifier
- Defined in:
- lib/htmlbeautifier/version.rb,
lib/htmlbeautifier.rb,
lib/htmlbeautifier/parser.rb,
lib/htmlbeautifier/builder.rb,
lib/htmlbeautifier/html_parser.rb
Overview
:nodoc:
Defined Under Namespace
Modules: VERSION Classes: Builder, HtmlParser, Parser
Class Method Summary collapse
-
.beautify(html, options = {}) ⇒ Object
Returns a beautified HTML/HTML+ERB document as a String.
Class Method Details
.beautify(html, options = {}) ⇒ Object
Returns a beautified HTML/HTML+ERB document as a String. html must be an object that responds to #to_s
.
Available options are: tab_stops - an integer for the number of spaces to indent, default 2 stop_on_errors - raise an exception on a badly-formed document. Default is false, i.e. continue to process the rest of the document.
15 16 17 18 19 |
# File 'lib/htmlbeautifier.rb', line 15 def self.beautify(html, = {}) ''.tap { |output| HtmlParser.new.scan html.to_s, Builder.new(output, ) } end |