diff options
author | kpdecker <kpdecker@gmail.com> | 2013-10-09 03:20:22 -0700 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-10-09 03:20:22 -0700 |
commit | b6c9f85d227aad8ed2db9c04f0eed5a7c7131879 (patch) | |
tree | fd4def9155be1c00af1e9433dfda22617d228ffa /lib/handlebars/runtime.js | |
parent | 0966f5172b39151e0fa2d4830709efec7e58e4ca (diff) | |
download | handlebars.js-b6c9f85d227aad8ed2db9c04f0eed5a7c7131879.zip handlebars.js-b6c9f85d227aad8ed2db9c04f0eed5a7c7131879.tar.gz handlebars.js-b6c9f85d227aad8ed2db9c04f0eed5a7c7131879.tar.bz2 |
Use template env and compile methods
Diffstat (limited to 'lib/handlebars/runtime.js')
-rw-r--r-- | lib/handlebars/runtime.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index f984fe6..c087b1e 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -22,9 +22,13 @@ function checkRevision(compilerInfo) { // TODO: Remove this line and break up compilePartial -export function template(templateSpec, Hbars, compile) { +export function template(templateSpec, env) { + if (!env) { + throw new Error("No environment passed to template"); + } + var invokePartialWrapper; - if (compile) { + if (env.compile) { invokePartialWrapper = function(partial, name, context, helpers, partials, data) { // TODO : Check this for all inputs and the options handling (partial flag, etc). This feels // like there should be a common exec path @@ -32,7 +36,7 @@ export function template(templateSpec, Hbars, compile) { if (result) { return result; } var options = { helpers: helpers, partials: partials, data: data }; - partials[name] = compile(partial, { data: data !== undefined }); + partials[name] = env.compile(partial, { data: data !== undefined }, env); return partials[name](context, options); }; } else { @@ -43,10 +47,6 @@ export function template(templateSpec, Hbars, compile) { }; } - if (!Hbars) { - throw new Error("YUNO HANDLEBARS"); - } - // Just add water var container = { escapeExpression: escapeExpression, @@ -78,7 +78,7 @@ export function template(templateSpec, Hbars, compile) { return function(context, options) { options = options || {}; - var namespace = options.partial ? options : Hbars, + var namespace = options.partial ? options : env, helpers, partials; |