Permalink
Browse files

[Haml] Make inner whitespace nuke consistent with loops. #465

%ul<
  - for str in %w[foo bar baz]
    = str

<ul>foobarbaz</ul>
  • Loading branch information...
1 parent 630b8fe commit 30623199872dc743a03a2b130202d7fba27693b4 @richardkmichael committed Feb 7, 2012
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/haml/compiler.rb
View
16 lib/haml/compiler.rb
@@ -53,10 +53,22 @@ def compile_plain
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

0 comments on commit 3062319

Please sign in to comment.