mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Escape interpolation
This commit is contained in:
parent
c97f17d7ed
commit
e2da721bc5
2 changed files with 6 additions and 8 deletions
|
@ -12,11 +12,9 @@ module Hamlit
|
|||
text = node.value[:text].rstrip
|
||||
if Haml::Util.contains_interpolation?(text)
|
||||
# FIXME: Confirm whether this is correct or not
|
||||
if @pretty
|
||||
[:dynamic, Haml::Util.unescape_interpolation(text)]
|
||||
else
|
||||
[:dynamic, Haml::Util.unescape_interpolation(text + "\n")]
|
||||
end
|
||||
text << "\n".freeze unless @pretty
|
||||
text = Haml::Util.unescape_interpolation(text)
|
||||
[:escape, true, [:dynamic, text]]
|
||||
else
|
||||
[:static, text]
|
||||
end
|
||||
|
|
|
@ -66,7 +66,7 @@ class FiltersTest < Haml::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test "should respect escaped newlines and interpolation" do; skip
|
||||
test "should respect escaped newlines and interpolation" do
|
||||
html = "\\n\n"
|
||||
haml = ":plain\n \\n\#{""}"
|
||||
assert_equal(html, render(haml))
|
||||
|
@ -117,7 +117,7 @@ class FiltersTest < Haml::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test "interpolated code should be escaped if escape_html is set" do; skip
|
||||
test "interpolated code should be escaped if escape_html is set" do
|
||||
assert_equal "<script>evil</script>\n",
|
||||
render(":plain\n \#{'<script>evil</script>'}", :escape_html => true)
|
||||
end
|
||||
|
@ -264,4 +264,4 @@ class RubyFilterTest < Haml::TestCase
|
|||
html = "7\n"
|
||||
assert_equal(html, render(haml))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue