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)|
|
||||
case type
|
||||
when :text
|
||||
[str << val.gsub('#{', "\\\#{"), mtabs + tabs]
|
||||
[str << val.gsub('#{', "\\\#{").inspect[1...-1], mtabs + tabs]
|
||||
when :script
|
||||
if mtabs != 0 && !@options[:ugly]
|
||||
val = "_hamlout.adjust_tabs(#{mtabs}); " + val
|
||||
|
@ -291,9 +291,9 @@ END
|
|||
|
||||
@precompiled <<
|
||||
if @options[:ugly]
|
||||
"_erbout << #{unescape_interpolation(text)};"
|
||||
"_erbout << \"#{text}\";"
|
||||
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
|
||||
@to_merge = []
|
||||
@dont_tab_up_next_text = false
|
||||
|
|
|
@ -338,6 +338,14 @@ HTML
|
|||
HAML
|
||||
end
|
||||
|
||||
def test_curly_brace
|
||||
assert_equal(<<HTML, render(<<HAML))
|
||||
Foo { Bar
|
||||
HTML
|
||||
== Foo { Bar
|
||||
HAML
|
||||
end
|
||||
|
||||
# HTML escaping tests
|
||||
|
||||
def test_ampersand_equals_should_escape
|
||||
|
|
Loading…
Reference in a new issue