1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Haml] Removed trailing whitespace from conditional comment openings.

This commit is contained in:
Norman Clarke 2009-09-15 16:56:28 -03:00 committed by Nathan Weizenbaum
parent 09cda35a99
commit 483e8a56e8
2 changed files with 8 additions and 8 deletions

View file

@ -109,8 +109,8 @@ END
names.map do |name| names.map do |name|
# Can't use || because someone might explicitly pass in false with a symbol # Can't use || because someone might explicitly pass in false with a symbol
sym_local = "_haml_locals[#{name.to_sym.inspect}]" sym_local = "_haml_locals[#{name.to_sym.inspect}]"
str_local = "_haml_locals[#{name.to_s.inspect}]" str_local = "_haml_locals[#{name.to_s.inspect}]"
"#{name} = #{sym_local}.nil? ? #{str_local} : #{sym_local}" "#{name} = #{sym_local}.nil? ? #{str_local} : #{sym_local}"
end.join(';') + ';' end.join(';') + ';'
end end
@ -719,7 +719,7 @@ END
else else
open_tag << "\n" unless parse || nuke_inner_whitespace || (self_closing && nuke_outer_whitespace) open_tag << "\n" unless parse || nuke_inner_whitespace || (self_closing && nuke_outer_whitespace)
end end
push_merged_text(open_tag, tag_closed || self_closing || nuke_inner_whitespace ? 0 : 1, push_merged_text(open_tag, tag_closed || self_closing || nuke_inner_whitespace ? 0 : 1,
!nuke_outer_whitespace) !nuke_outer_whitespace)
@ -775,11 +775,11 @@ END
raise SyntaxError.new('Illegal nesting: nesting within a tag that already has content is illegal.', @next_line.index) raise SyntaxError.new('Illegal nesting: nesting within a tag that already has content is illegal.', @next_line.index)
end end
open = "<!--#{conditional} " open = "<!--#{conditional}"
# Render it statically if possible # Render it statically if possible
unless line.empty? unless line.empty?
return push_text("#{open}#{line} #{conditional ? "<![endif]-->" : "-->"}") return push_text("#{open} #{line} #{conditional ? "<![endif]-->" : "-->"}")
end end
push_text(open, 1) push_text(open, 1)

View file

@ -26,7 +26,7 @@ stuff followed by whitespace
yee\ha yee\ha
</p> </p>
<!-- Short comment --> <!-- Short comment -->
<!-- <!--
This is a block comment This is a block comment
cool, huh? cool, huh?
<strong>there can even be sub-tags!</strong> <strong>there can even be sub-tags!</strong>
@ -35,13 +35,13 @@ stuff followed by whitespace
<p class=''>class attribute should appear!</p> <p class=''>class attribute should appear!</p>
<p>this attribute shouldn't appear</p> <p>this attribute shouldn't appear</p>
<!--[if lte IE6]> conditional comment! <![endif]--> <!--[if lte IE6]> conditional comment! <![endif]-->
<!--[if gte IE7]> <!--[if gte IE7]>
<p>Block conditional comment</p> <p>Block conditional comment</p>
<div> <div>
<h1>Cool, eh?</h1> <h1>Cool, eh?</h1>
</div> </div>
<![endif]--> <![endif]-->
<!--[if gte IE5.2]> <!--[if gte IE5.2]>
Woah a period. Woah a period.
<![endif]--> <![endif]-->
testtest testtest