def compile(precompiler, text)
resolve_lazy_requires
filter = self
precompiler.instance_eval do
if contains_interpolation?(text)
return if options[:suppress_eval]
text = unescape_interpolation(text).gsub(/(\\+)n/) do |s|
escapes = $1.size
next s if escapes % 2 == 0
("\\" * (escapes - 1)) + "\n"
end
newline if text.gsub!(/\n"\Z/, "\\n\"")
push_script "find_and_preserve(\#{filter.inspect}.render_with_options(\#{text}, _hamlout.options))\n".strip, :escape_html => false
return
end
rendered = Haml::Helpers::find_and_preserve(filter.render_with_options(text, precompiler.options), precompiler.options[:preserve])
if !options[:ugly]
push_text(rendered.rstrip.gsub("\n", "\n#{' ' * @output_tabs}"))
else
push_text(rendered.rstrip)
end
(text.count("\n") - 1).times {newline}
resolve_newlines
newline
end
end