diff --git a/lib/haml/engine.rb b/lib/haml/engine.rb index 00c21ca6..9a1ee9b8 100644 --- a/lib/haml/engine.rb +++ b/lib/haml/engine.rb @@ -162,7 +162,6 @@ END scope_object.instance_eval do extend Haml::Helpers @haml_buffer = buffer - @haml_is_haml = true end eval(@precompiled, scope, @options[:filename], 0) @@ -170,7 +169,6 @@ END # Get rid of the current buffer scope_object.instance_eval do @haml_buffer = buffer.upper - @haml_is_haml = false end buffer.buffer diff --git a/lib/haml/helpers.rb b/lib/haml/helpers.rb index b0eb04c9..bca90b66 100644 --- a/lib/haml/helpers.rb +++ b/lib/haml/helpers.rb @@ -37,7 +37,6 @@ module Haml # context.haml_tag :p, "Stuff" # def init_haml_helpers - @haml_is_haml = true @haml_buffer = Haml::Buffer.new(@haml_buffer, Haml::Engine.new('').send(:options_for_buffer)) nil end @@ -384,7 +383,7 @@ END # also works in other ActionView templates, # where it will always return false. def is_haml? - @haml_is_haml + not @haml_buffer.nil? end include ActionViewExtensions if self.const_defined? "ActionViewExtensions" diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb index 5309b882..9ca27ae7 100644 --- a/lib/haml/helpers/action_view_mods.rb +++ b/lib/haml/helpers/action_view_mods.rb @@ -2,10 +2,10 @@ if defined?(ActionView) and not defined?(Merb::Plugins) module ActionView class Base # :nodoc: def render_with_haml(*args, &block) - was_haml = is_haml? - @haml_is_haml = false + old_buffer = @haml_buffer + @haml_buffer = nil res = render_without_haml(*args, &block) - @haml_is_haml = was_haml + @haml_buffer = old_buffer res end alias_method :render_without_haml, :render diff --git a/lib/haml/precompiler.rb b/lib/haml/precompiler.rb index 9d1a24a6..079fede7 100644 --- a/lib/haml/precompiler.rb +++ b/lib/haml/precompiler.rb @@ -98,11 +98,9 @@ module Haml preamble = <