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) pattern = /([ ]*)<(textarea)([^>]*)>(\n|
)(.*?)(<\/\2>)/im input.gsub!(pattern) do |s| match = pattern.match(s) content = match[5] if match[4] == '
' content.sub!(/\A /, ' ') else content.sub!(/\A[ ]*/, '') end "#{match[1]}<#{match[2]}#{match[3]}>\n#{content}</#{match[2]}>" end end