[Haml] Fix interpolated if statements with HTML-escaping.
This commit is contained in:
parent
c5e91fe41f
commit
144c93ff0a
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
* Fix the `:encoding` option under Ruby 1.9.2.
|
* Fix the `:encoding` option under Ruby 1.9.2.
|
||||||
|
|
||||||
|
* Fix interpolated if statement when HTML escaping is enabled.
|
||||||
|
|
||||||
* Allow the `--unix-newlines` flag to work on Unix, where it's a no-op.
|
* Allow the `--unix-newlines` flag to work on Unix, where it's a no-op.
|
||||||
|
|
||||||
## 3.0.18
|
## 3.0.18
|
||||||
|
|
|
@ -1024,7 +1024,7 @@ END
|
||||||
res << '#{'
|
res << '#{'
|
||||||
else
|
else
|
||||||
content = eval('"' + balance(scan, ?{, ?}, 1)[0][0...-1] + '"')
|
content = eval('"' + balance(scan, ?{, ?}, 1)[0][0...-1] + '"')
|
||||||
content = "Haml::Helpers.html_escape(#{content})" if opts[:escape_html]
|
content = "Haml::Helpers.html_escape((#{content}))" if opts[:escape_html]
|
||||||
res << '#{' + content + "}"# Use eval to get rid of string escapes
|
res << '#{' + content + "}"# Use eval to get rid of string escapes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -774,6 +774,14 @@ HTML
|
||||||
HAML
|
HAML
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_escape_html_with_interpolated_if_statement
|
||||||
|
assert_equal(<<HTML, render(<<HAML, :escape_html => true))
|
||||||
|
foo,
|
||||||
|
HTML
|
||||||
|
foo\#{"," if true}
|
||||||
|
HAML
|
||||||
|
end
|
||||||
|
|
||||||
# HTML escaping tests
|
# HTML escaping tests
|
||||||
|
|
||||||
def test_ampersand_equals_should_escape
|
def test_ampersand_equals_should_escape
|
||||||
|
|
Loading…
Reference in New Issue