class Haml::Buffer
def fix_textareas!(input)
- Private: -
Other tags:
- Since: - Haml 4.0.1
Parameters:
-
input
(String
) -- The text to process
def fix_textareas!(input) return input unless toplevel? && input.include?('<textarea'.freeze) pattern = /<(textarea)([^>]*)>(\n|
)(.*?)<\/textarea>/im input.gsub!(pattern) do |s| match = pattern.match(s) content = match[4] if match[3] == '
' content.sub!(/\A /, ' ') else content.sub!(/\A[ ]*/, '') end "<#{match[1]}#{match[2]}>\n#{content}</#{match[1]}>" end input end