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:
Richard Michael 2012-02-07 14:50:54 -05:00 committed by Norman Clarke
parent 97d8ff6ae4
commit 1a30396d30
2 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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