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

Empty attributes render as real, empty attributes. Patch thanks to Jan Szumiec!

git-svn-id: svn://hamptoncatlin.com/haml/trunk@574 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-07-24 09:20:22 +00:00
parent 0b9b2dd742
commit b9949de4f5
3 changed files with 6 additions and 4 deletions

View file

@ -684,8 +684,8 @@ END
@other_quote_char = @options[:attr_wrapper] == '"' ? "'" : '"' @other_quote_char = @options[:attr_wrapper] == '"' ? "'" : '"'
result = attributes.collect do |a,v| result = attributes.collect do |a,v|
unless v.nil?
v = v.to_s v = v.to_s
unless v.nil? || v.empty?
attr_wrapper = @options[:attr_wrapper] attr_wrapper = @options[:attr_wrapper]
if v.include? attr_wrapper if v.include? attr_wrapper
if v.include? @other_quote_char if v.include? @other_quote_char

View file

@ -29,7 +29,8 @@ stuff followed by whitespace
<strong>there can even be sub-tags!</strong> <strong>there can even be sub-tags!</strong>
Or script! Or script!
--> -->
<p>class attribute shouldn't appear!</p> <p class=''>class attribute should 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>

View file

@ -33,7 +33,8 @@
-# -#
Nested Haml comment Nested Haml comment
- raise 'dead' - raise 'dead'
%p{ :class => "" } class attribute shouldn't appear! %p{ :class => "" } class attribute should appear!
%p{ :gorbachev => nil } this attribute shouldn't appear
/[if lte IE6] conditional comment! /[if lte IE6] conditional comment!
/[if gte IE7] /[if gte IE7]
%p Block conditional comment %p Block conditional comment