class Haml::Buffer

def fix_textareas!(input)

Other tags:
    Private: -

Other tags:
    Since: - Haml 4.0.1

Parameters:
  • input (String) -- The text to process
def fix_textareas!(input)
  pattern = /([ ]*)<(textarea)([^>]*)>(\n|&#x000A;)(.*?)(<\/\2>)/im
  input.gsub!(pattern) do |s|
    match = pattern.match(s)
    content = match[5]
    if match[4] == '&#x000A;'
      content.sub!(/\A /, '&#x0020;')
    else
      content.sub!(/\A[ ]*/, '')
    end
    "#{match[1]}<#{match[2]}#{match[3]}>\n#{content}</#{match[2]}>"
  end
end