Incorrect {{else}} behavior
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pybars |
Fix Released
|
High
|
Robert Collins |
Bug Description
Pybars behaves differently than Handlebars.js for the {{# if ...}}{{
1. Pybars should handle {{else}} just like Handlebars.js
2. Otherwise, Pybars should fail when you try to compile a template with an {{else}} block.
3. Otherwise, Pybars should document the {{else}} situation.
from pybars import Compiler
template = Compiler(
{{# if check}}
yep.
{{else}}
nope.
{{/if}}""")
template({"check": True}) # Outputs yep.
template({"check": False}) # Outputs nothing. It should output nope.
template({}) # Outputs nothing. It should output nope.
var template = Handlebars.
'{{# if check}}',
' yep.',
'{{else}}',
' nope.',
'{{/if}
template({"check": true}); // yep.
template({"check": false}); // nope.
template({}); // nope.
Related branches
- Robert Collins (community): Approve
- Diff: 0 lines
Changed in pybars: | |
assignee: | nobody → Robert Collins (lifeless) |
status: | Triaged → Fix Released |
Oh, whoops, I see you've already seen this. Release a new version pleeeeease!