module Haml::Helpers::ActionViewMods

def output_buffer

def output_buffer
  return haml_buffer.buffer if is_haml?
  super
end

def output_buffer=(new_buffer)

def output_buffer=(new_buffer)
  if is_haml?
    if Haml::Util.rails_xss_safe? && new_buffer.is_a?(ActiveSupport::SafeBuffer)
      new_buffer = String.new(new_buffer)
    end
    haml_buffer.buffer = new_buffer
  else
    super
  end
end

def render(*args, &block)

def render(*args, &block)
  options = args.first
  # If render :layout is used with a block, it concats rather than returning
  # a string so we need it to keep thinking it's Haml until it hits the
  # sub-render.
  if is_haml? && !(options.is_a?(Hash) && options[:layout] && block_given?)
    return non_haml { super }
  end
  super
end