Closed Breefield closed 11 years ago
Are you using the hamlbars helper?
= hb 'if author' do
= hb 'location.address'
= hb 'else'
= hb 'location.approx_area'
Closing since there has been no response.
Hey James, sorry for not getting back sooner—that works for me :+1:
Any reason we have to use the hb
helper? I find the {{}} syntax easier to read and type, but it seems there's bug(s) with parsing nested {{handlebars}}
statements eg. if conditions and the like.
The main reason is that HTML just sees {{}}
as text, and won't let you nest text within other text. For example, the following will raise an exception:
{{#each post in controller}}
{{post.title}}
{{/each}}
Whereas this won't:
=hb 'each post in controller' do
=hb 'post.title'
This parses as haml prior to handlebars.runtime, so the nesting breaks haml. One can wrap this in :plain, or not nest conditionals. Neither are ideal.