summaryrefslogtreecommitdiffstats
path: root/docs/compiler-api.md
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-11-29 18:19:52 -0600
committerkpdecker <kpdecker@gmail.com>2014-11-29 18:20:11 -0600
commitf84f76f006a7992d9f82d14f4ebff64687fefa05 (patch)
treedfe875d1e1c246093ac355cab670970d7b5628e8 /docs/compiler-api.md
parent96c1300f15968e937f170385ae52b633f7fa5019 (diff)
downloadhandlebars.js-f84f76f006a7992d9f82d14f4ebff64687fefa05.zip
handlebars.js-f84f76f006a7992d9f82d14f4ebff64687fefa05.tar.gz
handlebars.js-f84f76f006a7992d9f82d14f4ebff64687fefa05.tar.bz2
Add basic docs for JavaScriptCompiler override API
Diffstat (limited to 'docs/compiler-api.md')
-rw-r--r--docs/compiler-api.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/compiler-api.md b/docs/compiler-api.md
index 5431a98..98ca894 100644
--- a/docs/compiler-api.md
+++ b/docs/compiler-api.md
@@ -208,6 +208,29 @@ scanner.accept(ast);
The `Handlebars.JavaScriptCompiler` object has a number of methods that may be customized to alter the output of the compiler:
+- `nameLookup(parent, name, type)`
+ Used to generate the code to resolve a give path component.
+
+ - `parent` is the existing code in the path resolution
+ - `name` is the current path component
+ - `type` is the type of name being evaluated. May be one of `context`, `data`, `helper`, or `partial`.
+
+- `depthedLookup(name)`
+ Used to generate code that resolves parameters within any context in the stack. Is only used in `compat` mode.
+
+- `compilerInfo()`
+ Allows for custom compiler flags used in the runtime version checking logic.
+
+- `appendToBuffer(source, location, explicit)`
+ Allows for code buffer emitting code. Defaults behavior is string concatenation.
+
+ - `source` is the source code whose result is to be appending
+ - `location` is the location of the source in the source map.
+ - `explicit` is a flag signaling that the emit operation must occur, vs. the lazy evaled options otherwise.
+
+- `initializeBuffer()`
+ Allows for buffers other than the default string buffer to be used. Generally needs to be paired with a custom `appendToBuffer` implementation.
+
```javascript
function MyCompiler() {
Handlebars.JavaScriptCompiler.apply(this, arguments);