On 08/03/2015 12:21, Pierre MARTIN wrote:
However, I find myself in an awkward situation when i have to translate something like this: <a ui-sref='foo' ui-sref-active='bar'>Hi!</a> The only solution i have found so far is this, and i'm really not happy with it: %a{ 'ui-sref'=>'foo', 'ui-sref-active'=>'bar' } Hi!How would one model this very example with clean hashy syntax using HAML please? Is there an way to tell HAML to use something as our "anonymous" hash top-level value, eg: %a{ ui: { sref: { special_sym: 'foo', active: 'bar' } } } Hi! I have tried this: %a{ ui: { sref: { ''=>'foo', active: 'bar' } } } Hi! But it generates this: <a ui-sref-='foo', ui-sref-active='bar'>Hi!</a> How do you guys accommodate with this problem? Is there anything wrong in my approach / why?
I think you’ve found a weakness in the current behaviour, I can’t see a better way than how you’re currently doing this. Perhaps we could have a special case for the empty string as a key, so that Haml doesn’t add the trailing '-', so that your last example would work. This is probably worth opening as bug. Matt -- You received this message because you are subscribed to the Google Groups "Haml" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/haml. For more options, visit https://groups.google.com/d/optout.
