mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Make sure %textarea and &= interact properly.
This commit is contained in:
parent
7bd150892c
commit
53508642df
2 changed files with 7 additions and 3 deletions
|
@ -104,15 +104,15 @@ module Haml
|
|||
escape_html = false, nuke_inner_whitespace = false)
|
||||
tabulation = @real_tabs
|
||||
|
||||
result = result.to_s.rstrip
|
||||
result = html_escape(result) if escape_html
|
||||
|
||||
if preserve_tag
|
||||
result = Haml::Helpers.preserve(result)
|
||||
elsif preserve_script
|
||||
result = Haml::Helpers.find_and_preserve(result, options[:preserve])
|
||||
end
|
||||
|
||||
result = result.to_s.rstrip
|
||||
result = html_escape(result) if escape_html
|
||||
|
||||
has_newline = result.include?("\n")
|
||||
if in_tag && !nuke_inner_whitespace && (@options[:ugly] || !has_newline || preserve_tag)
|
||||
@buffer << result
|
||||
|
|
|
@ -190,6 +190,10 @@ SOURCE
|
|||
assert_equal("<p>foo & bar</p>\n", render("%p&= 'foo & bar'", :escape_html => false))
|
||||
end
|
||||
|
||||
def test_ampersand_equals_should_escape_before_preserve
|
||||
assert_equal("<textarea>foo
bar</textarea>\n", render('%textarea&= "foo\nbar"', :escape_html => false))
|
||||
end
|
||||
|
||||
def test_bang_equals_should_not_escape
|
||||
assert_equal("<p>\n foo & bar\n</p>\n", render("%p\n != 'foo & bar'", :escape_html => true))
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue