2011/12/19 Magnus Holm <judo...@gmail.com>:
> That's actually supported. If an attribute is `true` it will use the
> attribute name as the value. (so checked: true is the same as checked:
> "checked"). Also, false and nil attributes won't be included.
>>

I think this is a little inconsistent now. We're already checking
whther a tag can have content according to an arbitrary list (taken
from HTML5 standard, I suppose) - we should probably also check
whether an attribute must have content, or can be boolean (or, to
check neither - it would be cool if it was possible to disable this
validation, I sometimes use Markaby for generating XML, or RSS feeds).

There might exist valid reasons for passing `true`/`false` as
attribute value and expecting it to show up (possibly for value
attribute on select list options or radio buttons), as well as passing
a truthy value that is not `true` itself (for example,
Numeric#nonzero? returns either `false` or `self`, and one might want
to have a checkbox checked or not according to it).

Both of the above problems can be solved by using respectively
`true_or_false.to_s` or `!!integer.nonzero?`, but both of these
solutions are kind of ugly.

I can change the code myself if you don't feel like it. :)


-- Matma Rex
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to