This is a known issue due to the way in which the regular expression
for element hash attributes. Basically the end of the "#{action}" is
being captured into the list of hash attributes. This then breaks
because there is an extra closing brace where HAML doesn't expect
there to be one.
The only work around at the moment is to avoid using the "#{action}"
string interpolation style when using a HAML element attribute hash.
You will either need to use
'string1' + string2
style of mixing strings, or I have added an alias for the
Ruby :sprintf method as just :s. So I would call
s("string1%s", string2)
which still doesn't look too bad.
Hope that helps,
Geoff
On Oct 26, 7:48 pm, Aman Gupta <[EMAIL PROTECTED]> wrote:
> >> Haml::Engine.new(%{- %w[agree disagree].each do |action|\n %a== i
> >> \#{action}}).render
>
> => "<a>i agree</a>\n<a>i disagree</a>\n"
>
> >> Haml::Engine.new(%{- %w[agree disagree].each do |action|\n %a{ :href =>
> >> '#' }== i \#{action}}).render
>
> SyntaxError: (eval):14:in `compile': compile error
> (eval):9: parse error, unexpected '}', expecting ')'
> _hamlout.open_tag("a", 0, nil, false, {}, nil, :href => '' }== i
> #{action)
> ^
> from (haml):2
> from /opt/local/lib/ruby/gems/1.8/gems/haml-1.7.1/lib/haml/
> engine.rb:433:in `compile'
> from /opt/local/lib/ruby/gems/1.8/gems/haml-1.7.1/lib/haml/
> engine.rb:186:in `render'
> from (irb):21
> from :0
>
> It looks like a bug where the } from the #{action} and ) from the
> _hamlout.open_tag() get swapped. Any ideas?
>
> Aman Gupta
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---