Fixing a string interpolation bug. Thanks, Toons!

git-svn-id: svn://hamptoncatlin.com/haml/trunk@580 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-08-11 19:10:28 +00:00
parent b83cbfa3b3
commit e55be25534
2 changed files with 7 additions and 2 deletions

View File

@ -887,12 +887,12 @@ END
if first.nil?
return str.dump
elsif first != 0
first -= 1
first += 1
end
last = str.rindex '}'
interpolation = str.slice!(first, last + 1)
interpolation = str.slice!(first, last - first)
str.insert(first, "_haml_interpolation")
str = str.dump

View File

@ -70,6 +70,11 @@ class EngineTest < Test::Unit::TestCase
assert_equal("<p>\n Hello World\n</p>\n", render("%p\n == Hello \#{who}", :locals => {:who => 'World'}))
end
def test_double_equals_in_the_middle_of_a_string
assert_equal("\"title 'Title'. \"\n",
render("== \"title '\#{\"Title\"}'. \""))
end
# Options tests
def test_stop_eval