diff options
author | kpdecker <kpdecker@gmail.com> | 2015-01-18 13:23:45 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2015-01-18 13:23:45 -0600 |
commit | cb51b82b8e8114aaa3e1b19c41e5c4eebf0539d5 (patch) | |
tree | 386038a4a43f85e19dfee0f996cce66f10c10d8f /src | |
parent | b0b522b4f81baf5ba4c190b59abd2b9cfe82bc77 (diff) | |
download | handlebars.js-cb51b82b8e8114aaa3e1b19c41e5c4eebf0539d5.zip handlebars.js-cb51b82b8e8114aaa3e1b19c41e5c4eebf0539d5.tar.gz handlebars.js-cb51b82b8e8114aaa3e1b19c41e5c4eebf0539d5.tar.bz2 |
Add support for dynamic partial names
Uses the subexpression syntax to allow for dynamic partial lookups. Ex:
```
{{> (helper) }}
```
Fixes #933
Diffstat (limited to 'src')
-rw-r--r-- | src/handlebars.yy | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/handlebars.yy b/src/handlebars.yy index 27985b8..6ca32d9 100644 --- a/src/handlebars.yy +++ b/src/handlebars.yy @@ -77,7 +77,13 @@ mustache ; partial - : OPEN_PARTIAL sexpr CLOSE -> new yy.PartialStatement($2, yy.stripFlags($1, $3), yy.locInfo(@$)) + : OPEN_PARTIAL partial_expr CLOSE -> new yy.PartialStatement($2, yy.stripFlags($1, $3), yy.locInfo(@$)) + ; + +partial_expr + : helperName param* hash? -> new yy.PartialExpression($1, $2, $3, yy.locInfo(@$)) + | dataName -> new yy.PartialExpression($1, null, null, yy.locInfo(@$)) + | OPEN_SEXPR sexpr CLOSE_SEXPR param* hash? -> new yy.PartialExpression($2, $4, $5, yy.locInfo(@$)) ; sexpr |