Context helpers does not work with conditionals
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 461
- PR merge metrics
- No merged PRs in 30d
Description
The dustjs manual at http://www.dustjs.com/guides/context-helpers/#writing-context-helpers insinuates that context helpers can be used with both sections (`{#helper}`) and conditionals (`{?helper}`). However, conditionals only seem to test truthy/falsy... thus always returning true for functions/helpers.
the following code always console.logs `
? PASS
`.```
var data = {
helper: function() {
return false;
}
}
var src = '
{#helper}# PASS!{/helper}
{?helper}? PASS{/helper}
';dust.renderSource(src, data, function(err, html) {
console.log(html);
})
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the example with dust.renderSource from the issue and compare the documented context-helper behavior for sections and conditionals at the linked DustJS manual page. Trace how conditional helpers are evaluated, then add regression coverage showing the helper's returned false value is respected and verify the rendered output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100