1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Get rid of @haml_is_haml in favor of checking for the existance of @haml_buffer.

This commit is contained in:
Nathan Weizenbaum 2008-04-24 09:58:10 -07:00
parent 6c0473e38e
commit d4a1a35084
4 changed files with 4 additions and 9 deletions

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -98,11 +98,9 @@ module Haml
preamble = <<END.gsub("\n", ";")
extend Haml::Helpers
_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, #{options_for_buffer.inspect})
@haml_is_haml = true
_erbout = _hamlout.buffer
END
postamble = <<END.gsub("\n", ";")
@haml_is_haml = false
@haml_buffer = @haml_buffer.upper
_erbout
END