mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Haml] Fix an interpolation-handling error.
This commit is contained in:
parent
8f2d57722f
commit
266c8ecac6
2 changed files with 11 additions and 3 deletions
|
@ -278,7 +278,7 @@ END
|
||||||
text, tab_change = @to_merge.inject(["", 0]) do |(str, mtabs), (type, val, tabs)|
|
text, tab_change = @to_merge.inject(["", 0]) do |(str, mtabs), (type, val, tabs)|
|
||||||
case type
|
case type
|
||||||
when :text
|
when :text
|
||||||
[str << val.gsub('#{', "\\\#{"), mtabs + tabs]
|
[str << val.gsub('#{', "\\\#{").inspect[1...-1], mtabs + tabs]
|
||||||
when :script
|
when :script
|
||||||
if mtabs != 0 && !@options[:ugly]
|
if mtabs != 0 && !@options[:ugly]
|
||||||
val = "_hamlout.adjust_tabs(#{mtabs}); " + val
|
val = "_hamlout.adjust_tabs(#{mtabs}); " + val
|
||||||
|
@ -291,9 +291,9 @@ END
|
||||||
|
|
||||||
@precompiled <<
|
@precompiled <<
|
||||||
if @options[:ugly]
|
if @options[:ugly]
|
||||||
"_erbout << #{unescape_interpolation(text)};"
|
"_erbout << \"#{text}\";"
|
||||||
else
|
else
|
||||||
"_hamlout.push_text(#{unescape_interpolation(text)}, #{tab_change}, #{@dont_tab_up_next_text.inspect});"
|
"_hamlout.push_text(\"#{text}\", #{tab_change}, #{@dont_tab_up_next_text.inspect});"
|
||||||
end
|
end
|
||||||
@to_merge = []
|
@to_merge = []
|
||||||
@dont_tab_up_next_text = false
|
@dont_tab_up_next_text = false
|
||||||
|
|
|
@ -338,6 +338,14 @@ HTML
|
||||||
HAML
|
HAML
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_curly_brace
|
||||||
|
assert_equal(<<HTML, render(<<HAML))
|
||||||
|
Foo { Bar
|
||||||
|
HTML
|
||||||
|
== Foo { Bar
|
||||||
|
HAML
|
||||||
|
end
|
||||||
|
|
||||||
# HTML escaping tests
|
# HTML escaping tests
|
||||||
|
|
||||||
def test_ampersand_equals_should_escape
|
def test_ampersand_equals_should_escape
|
||||||
|
|
Loading…
Add table
Reference in a new issue