handlebars-lang / handlebars.js

Minimal templating on steroids.
http://handlebarsjs.com
MIT License
17.83k stars 2.04k forks source link

{{*inline}} cannot take SubExpressions as arguments #1372

Open nknapp opened 6 years ago

nknapp commented 6 years ago

While investigating on #1371, I have noticed, that while

{{#*inline "stuff"}}
MyContents
{{/inline}}
{{> stuff}}

obviously works (https://jsfiddle.net/vva7musq/25/), the following template does run into an error when executing the template with { some: 'stuff' } as input:

{{#*inline (some)}}
MyContents
{{/inline}}
{{> stuff}}

see https://jsfiddle.net/vva7musq/28/

This should work, shouldn't it? Or is there something I have missed. The error is:

helpers is not defined
anonymous@https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js line 3670 > Function:5:162
executeDecorators@https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js:1340:13
ret@https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js:1215:13
ret@https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js:3488:13
window.onload@https://fiddle.jshell.net/_display/:56:49

The AST looks fine as far as I can tell.

nknapp commented 4 years ago

I am labeling this as feature, because I want to deprecate custom decorators. It is a deficite with inline partials, but currently, it is just something we do not support.