def fix_textareas!(input)
      return input unless input.include?('<textarea'.freeze)

      pattern = /<(textarea)([^>]*)>(\n|&#x000A;)(.*?)<\/textarea>/im
      input.gsub!(pattern) do |s|
        match = pattern.match(s)
        content = match[4]
        if match[3] == '&#x000A;'
          content.sub!(/\A /, '&#x0020;')
        else
          content.sub!(/\A[ ]*/, '')
        end
        "<#{match[1]}#{match[2]}>\n#{content}</#{match[1]}>"
      end
      input
    end
def fix_textareas!(input)
      return input unless input.include?('<textarea'.freeze)

      pattern = /<(textarea)([^>]*)>(\n|&#x000A;)(.*?)<\/textarea>/im
      input.gsub!(pattern) do |s|
        match = pattern.match(s)
        content = match[4]
        if match[3] == '&#x000A;'
          content.sub!(/\A /, '&#x0020;')
        else
          content.sub!(/\A[ ]*/, '')
        end
        "<#{match[1]}#{match[2]}>\n#{content}</#{match[1]}>"
      end
      input
    end
Works like #{find_and_preserve}, but allows the first newline after a
 preserved opening tag to remain unencoded, and then outdents the content.
 This change was motivated primarily by the change in Rails 3.2.3 to emit
 a newline after textarea helpers.

 @param input [String] The text to process
 @since Haml 4.0.1
 @private