Module: HtmlFormatter
- Defined in:
- lib/htmlformatter/version.rb,
lib/htmlformatter.rb,
lib/htmlformatter/parser.rb,
lib/htmlformatter/builder.rb,
lib/htmlformatter/html_parser.rb,
lib/htmlformatter/ruby_indenter.rb,
lib/htmlformatter/elixir_indenter.rb
Overview
:nodoc:
Defined Under Namespace
Modules: VERSION Classes: Builder, ElixirIndenter, HtmlParser, Parser, RubyIndenter
Class Method Summary collapse
-
.format(html, options = {}) ⇒ Object
Returns a formatted HTML/HTML+EEX document as a String.
Class Method Details
.format(html, options = {}) ⇒ Object
Returns a formatted HTML/HTML+EEX 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. Deprecated: see indent. indent - what to indent with (“ ”, “t” etc.), default “ ” stop_on_errors - raise an exception on a badly-formed document. Default is false, i.e. continue to process the rest of the document. initial_level - The entire output will be indented by this number of steps. Default is 0. keep_blank_lines - an integer for the number of consecutive empty lines to keep in output.
21 22 23 24 25 26 27 28 |
# File 'lib/htmlformatter.rb', line 21 def self.format(html, = {}) if [:tab_stops] [:indent] = " " * [:tab_stops] end "".tap { |output| HtmlParser.new.scan html.to_s, Builder.new(output, ) } end |