Make the content_tag mods not die outside Haml.

This commit is contained in:
Nathan Weizenbaum 2008-03-08 15:27:59 -08:00
parent 243f46d5dd
commit 722c68f9de
1 changed files with 9 additions and 1 deletions

View File

@ -43,7 +43,11 @@ if defined?(ActionView) and not defined?(Merb::Plugins)
module TagHelper
def content_tag_with_haml(name, *args, &block)
content = content_tag_without_haml(name, *args, &block)
content = Haml::Helpers.preserve content if haml_buffer.options[:preserve].include?(name.to_s)
if is_haml? && haml_buffer.options[:preserve].include?(name.to_s)
content = Haml::Helpers.preserve content
end
content
end
alias_method :content_tag_without_haml, :content_tag
@ -57,6 +61,10 @@ if defined?(ActionView) and not defined?(Merb::Plugins)
@template_object.send :haml_buffer
end
def is_haml?
@template_object.send :is_haml?
end
alias_method :content_tag_without_haml, :content_tag
alias_method :content_tag, :content_tag_with_haml
end