Yikes... it looks like we've never had a test for the empty string as an
attribute. What's more, it looks like the behavior has changed over the
versions... in 1.0, %foo{:bar => ''}/ rendered as <foo bar='' />, but in 1.5and
1.7 it renders as <foo />. In trunk it's back to <foo bar='' />. I think <foo
bar='' /> makes the most sense, as we already have %foo{:bar => nil}/ to get
rid of the element.

Anyway, this shouldn't be too hard to fix. I'll get on it as soon as I have
time. I guess a 1.7.3 release is just around the corner...

- Nathan

On Nov 19, 2007 9:39 AM, dschn <[EMAIL PROTECTED]> wrote:

>
> This example:
>
> %img{:src=>"/images/admin/icons/accept.png", :alt =>
> "", :valign=>"middle"}/
>
> (The empty :alt => '' is the problem. It appears this happens with any
> empty attribute.)
>
> Produces this error:
>
> can't convert nil into String
>
> Stack trace:
>
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:685:in `sort'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:685:in
> `build_attributes'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:695:in
> `prerender_tag'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:752:in
> `render_tag'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:702:in `scan'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:702:in
> `render_tag'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:312:in
> `process_line'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:254:in
> `do_precompile'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:433:in
> `each_with_index'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:229:in `each'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:229:in
> `each_with_index'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:229:in
> `do_precompile'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/engine.rb:173:in
> `initialize'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/template.rb:62:in `new'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/template.rb:62:in `render'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/haml/template.rb:96:in
> `render_template'
> app/controllers/cart_controller.rb:7:in `index'
> app/controllers/application.rb:40:in `set_time_zone'
> /Library/Ruby/Gems/gems/haml-1.7.2/lib/sass/plugin/rails.rb:14:in
> `process'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel/rails.rb:76:in
> `process'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel/rails.rb:74:in
> `synchronize'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel/rails.rb:74:in
> `process'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:155:in
> `process_client'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:154:in `each'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:154:in
> `process_client'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `run'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:281:in
> `initialize'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `new'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `run'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:264:in
> `initialize'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:264:in `new'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel.rb:264:in `run'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel/configurator.rb:
> 282:in `run'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel/configurator.rb:
> 281:in `each'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel/configurator.rb:
> 281:in `run'
> /Library/Ruby/Gems/gems/mongrel-1.0.3/bin/mongrel_rails:122:in `run'
> /Library/Ruby/Gems/gems/mongrel-1.1.1/lib/mongrel/command.rb:212:in
> `run'
> /Library/Ruby/Gems/gems/mongrel-1.0.3/bin/mongrel_rails:276
>
> To be sure I also tested it with the haml binary outside of Rails and
> the same error is produced. My apologies if this is specific to my
> setup - it doesn't appear to be though.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to