Closed mmontagna closed 9 years ago
I believe Handlebars.php should follows Handlebars.js logic. Thus if Handlebars.js just skips such blocks, you've found a bug.
Yes I can confirm that it does skip such blocks. I am trying to run some templates which are currently run under Handlebars.js just fine, but fail to run under Handlebars.php. I'll submit a pull request, that "fixes" the bug, though someone should review it, as I just started looking at this codebase, I could've been too heavy handed.
By the way, I've created a JS Fiddle which illustrates Handlebars.js behavior: http://jsfiddle.net/yxo4yb3q/1/
Fixed with #121. Thank you, @mmontagna !
If I have a template like this: {{#Item}} ... {{/Item}}
And the hash I pass it does not have an "Item" key I expect the template to simply skip the block, but in handlebars.php it throws an exception. I'm not 100% sure this is either the correct or incorrect behavior, but I assumed it would simply skip the block. I'm basing this assumption on the mustache spec: (github.com/mustache/spec/blob/master/specs/sections.yml) see 'Failed context lookups should be considered falsey'
I can submit a pull request if this should be changed to simply skip the block.