class Haml::Escapable

Haml::Herlpers.html_escape and Haml::Herlpers.escape_once.
Like Temple::Filters::Escapable, but with support for escaping by

def escape(value)

def escape(value)
  if @escape_safe_buffer
    ::Haml::Helpers.html_escape_without_haml_xss(value)
  else
    ::Haml::Helpers.html_escape(value)
  end
end

def escape_code(value)

def escape_code(value)
  "::Haml::Helpers.html_escape#{('_without_haml_xss' if @escape_safe_buffer)}((#{value}))"
end

def escape_once(value)

def escape_once(value)
  if @escape_safe_buffer
    ::Haml::Helpers.escape_once_without_haml_xss(value)
  else
    ::Haml::Helpers.escape_once(value)
  end
end

def escape_once_code(value)

def escape_once_code(value)
  "::Haml::Helpers.escape_once#{('_without_haml_xss' if @escape_safe_buffer)}((#{value}))"
end

def initialize(*)

def initialize(*)
  super
  @escape = false
  @escape_safe_buffer = false
end

def on_dynamic(value)

The same as Haml::AttributeBuilder.build_attributes
def on_dynamic(value)
  [:dynamic,
   if @escape == :once
     escape_once_code(value)
   elsif @escape
     escape_code(value)
   else
     "(#{value}).to_s"
   end
  ]
end

def on_escape(flag, exp)

def on_escape(flag, exp)
  old_escape, old_escape_safe_buffer = @escape, @escape_safe_buffer
  @escape_safe_buffer = flag.is_a?(EscapeSafeBuffer)
  @escape = @escape_safe_buffer ? flag.value : flag
  compile(exp)
ensure
  @escape, @escape_safe_buffer = old_escape, old_escape_safe_buffer
end

def on_static(value)

The same as Haml::AttributeBuilder.build_attributes
def on_static(value)
  [:static,
   if @escape == :once
     escape_once(value)
   elsif @escape
     escape(value)
   else
     value
   end
  ]
end