def preserve(input = nil, &block)
      return preserve(capture_haml(&block)) if block
      s = input.to_s.chomp("\n")
      s.gsub!(/\n/, '&#x000A;')
      s.delete!("\r")
      s
    end
def preserve(input = nil, &block)
      return preserve(capture_haml(&block)) if block
      s = input.to_s.chomp("\n")
      s.gsub!(/\n/, '&#x000A;')
      s.delete!("\r")
      s
    end
Takes any string, finds all the newlines, and converts them to
 HTML entities so they'll render correctly in
 whitespace-sensitive tags without screwing up the indentation.

 @overload preserve(input)
   Escapes newlines within a string.

   @param input [String] The string within which to escape all newlines
 @overload preserve
   Escapes newlines within a block of Haml code.

   @yield The block within which to escape newlines