mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Fixes a bug where calling Engine#to_html multiple times on the same Engine object duplicated the text
each time. git-svn-id: svn://hamptoncatlin.com/haml/branches/edge@102 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
47616c9c97
commit
aa9289b9cc
2 changed files with 8 additions and 2 deletions
|
@ -100,8 +100,6 @@ module Haml
|
|||
options.each { |k,v| eval("@#{k} = v") }
|
||||
|
||||
@template = template #String
|
||||
@buffer = Haml::Buffer.new
|
||||
|
||||
@to_close_stack = []
|
||||
@tabulation = 0
|
||||
|
||||
|
@ -114,6 +112,7 @@ module Haml
|
|||
# a string.
|
||||
def to_html(scope = Object.new, &block)
|
||||
@scope_object = scope
|
||||
@buffer = Haml::Buffer.new
|
||||
|
||||
# Compile the @precompiled buffer
|
||||
compile &block
|
||||
|
|
|
@ -48,4 +48,11 @@ class EngineTest < Test::Unit::TestCase
|
|||
def test_long_liner_should_not_print_on_one_line
|
||||
assert_equal("<div>\n #{'x' * 51}\n</div>", render("%div #{'x' * 51}").chomp)
|
||||
end
|
||||
|
||||
def test_multi_render
|
||||
engine = Haml::Engine.new("%strong Hi there!")
|
||||
assert_equal("<strong>Hi there!</strong>\n", engine.to_html)
|
||||
assert_equal("<strong>Hi there!</strong>\n", engine.to_html)
|
||||
assert_equal("<strong>Hi there!</strong>\n", engine.to_html)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue