Class: HtmlBeautifier::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/htmlbeautifier/builder.rb

Constant Summary collapse

RUBY_INDENT =
%r{ ^ ( if | unless | while | begin | elsif | else )\b
| \b ( do | \{ ) ( \s* \| [^\|]+ \| )? $
}x
RUBY_OUTDENT =
%r{ ^ ( end | elsif | else |\} ) \b
}x
ELEMENT_CONTENT =
%r{ (?:[^<>]|<%.*?%>)* }mx
DEFAULT_OPTIONS =
{
  tab_stops: 2,
  stop_on_errors: false
}

Instance Method Summary collapse

Constructor Details

#initialize(output, options = {}) ⇒ Builder

Returns a new instance of Builder.



20
21
22
23
24
25
26
27
28
29
# File 'lib/htmlbeautifier/builder.rb', line 20

def initialize(output, options = {})
  options = DEFAULT_OPTIONS.merge(options)
  @level = 0
  @new_line = false
  @tab = ' ' * options[:tab_stops]
  @stop_on_errors = options[:stop_on_errors]
  @output = output
  @empty = true
  @ie_cc_levels = []
end