mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Make inner whitespace nuke consistent with loops.
%ul< - for str in %w[foo bar baz] = str <ul>foobarbaz</ul> See #465 for discussion. Closes #489. Signed-off-by: Norman Clarke <norman@njclarke.com>
This commit is contained in:
parent
97d8ff6ae4
commit
1a30396d30
2 changed files with 17 additions and 2 deletions
|
@ -37,6 +37,9 @@
|
|||
* html2haml now includes an `--html-attributes` option.
|
||||
(thanks [Stefan Natchev](https://github.com/snatchev))
|
||||
|
||||
* Fix for inner whitespace removal in loops.
|
||||
(thanks [Richard Michael](https://github.com/richardkmichael))
|
||||
|
||||
## 3.1.5 (Unreleased)
|
||||
|
||||
* Respect Rails' `html_safe` flag when escaping attribute values
|
||||
|
|
|
@ -53,10 +53,22 @@ END
|
|||
push_text @node.value[:text]
|
||||
end
|
||||
|
||||
def nuke_inner_whitespace?(node)
|
||||
if node.value && node.value[:nuke_inner_whitespace]
|
||||
true
|
||||
elsif node.parent
|
||||
nuke_inner_whitespace?(node.parent)
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def compile_script(&block)
|
||||
push_script(@node.value[:text],
|
||||
:preserve_script => @node.value[:preserve],
|
||||
:escape_html => @node.value[:escape_html], &block)
|
||||
:preserve_script => @node.value[:preserve],
|
||||
:escape_html => @node.value[:escape_html],
|
||||
:nuke_inner_whitespace => nuke_inner_whitespace?(@node),
|
||||
&block)
|
||||
end
|
||||
|
||||
def compile_silent_script
|
||||
|
|
Loading…
Reference in a new issue