summaryrefslogtreecommitdiffstats
path: root/docs/compiler-api.md
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2015-01-18 13:23:45 -0600
committerkpdecker <kpdecker@gmail.com>2015-01-18 13:23:45 -0600
commitcb51b82b8e8114aaa3e1b19c41e5c4eebf0539d5 (patch)
tree386038a4a43f85e19dfee0f996cce66f10c10d8f /docs/compiler-api.md
parentb0b522b4f81baf5ba4c190b59abd2b9cfe82bc77 (diff)
downloadhandlebars.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 'docs/compiler-api.md')
-rw-r--r--docs/compiler-api.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/compiler-api.md b/docs/compiler-api.md
index 74af672..4a0ec01 100644
--- a/docs/compiler-api.md
+++ b/docs/compiler-api.md
@@ -115,6 +115,17 @@ interface SubExpression <: Expression {
`isHelper` is not required and is used to disambiguate between cases such as `{{foo}}` and `(foo)`, which have slightly different call behaviors.
+```java
+interface PartialExpression <: Expression {
+ type: "PartialExpression";
+ name: PathExpression | SubExpression;
+ params: [ Expression ];
+ hash: Hash;
+}
+```
+
+`path` may be a `SubExpression` when tied to a dynamic partial, i.e. `{{> (foo) }}`
+
##### Paths
```java
@@ -221,6 +232,8 @@ The `Handlebars.JavaScriptCompiler` object has a number of methods that may be c
- `name` is the current path component
- `type` is the type of name being evaluated. May be one of `context`, `data`, `helper`, or `partial`.
+ Note that this does not impact dynamic partials, which implementors need to be aware of. Overriding `VM.resolvePartial` may be required to support dynamic cases.
+
- `depthedLookup(name)`
Used to generate code that resolves parameters within any context in the stack. Is only used in `compat` mode.