FIX: Allow subexpressions in raw handlebars helpers

Helpers registered via `registerUnbound` did not receive parameters if they were subexpressions.
For example: `{{helper1 key=(helper2 value)}}`
This commit is contained in:
David Taylor 2019-02-08 12:58:10 +00:00
parent 95b5c5898e
commit babd80dfd1
1 changed files with 5 additions and 1 deletions

View File

@ -32,7 +32,11 @@ function resolveParams(ctx, options) {
if (options.hashTypes) { if (options.hashTypes) {
Object.keys(hash).forEach(function(k) { Object.keys(hash).forEach(function(k) {
const type = options.hashTypes[k]; const type = options.hashTypes[k];
if (type === "STRING" || type === "StringLiteral") { if (
type === "STRING" ||
type === "StringLiteral" ||
type === "SubExpression"
) {
params[k] = hash[k]; params[k] = hash[k];
} else if (type === "ID" || type === "PathExpression") { } else if (type === "ID" || type === "PathExpression") {
params[k] = get(ctx, hash[k], options); params[k] = get(ctx, hash[k], options);