Rename Handlebars.VM.compile to Handelbars.VM.template
This commit is contained in:
+7
-13
@@ -2,10 +2,10 @@ var Handlebars = require("./base");
|
||||
|
||||
// BEGIN(BROWSER)
|
||||
Handlebars.VM = {
|
||||
generateContainer: function(template) {
|
||||
template: function(templateSpec) {
|
||||
// Setup all children
|
||||
for (var i = 0, len = template.children.length; i < len; i++) {
|
||||
template.children[i] = this.generateContainer(template.children[i]);
|
||||
for (var i = 0, len = templateSpec.children.length; i < len; i++) {
|
||||
templateSpec.children[i] = Handlebars.VM.template(templateSpec.children[i]);
|
||||
}
|
||||
|
||||
// Just add water
|
||||
@@ -27,8 +27,8 @@ Handlebars.VM = {
|
||||
programWithDepth: Handlebars.VM.programWithDepth,
|
||||
noop: Handlebars.VM.noop
|
||||
};
|
||||
container.render = template.fn;
|
||||
container.children = template.children;
|
||||
container.render = templateSpec.fn;
|
||||
container.children = templateSpec.children;
|
||||
|
||||
return function(context, options, $depth) {
|
||||
options = options || {};
|
||||
@@ -66,13 +66,6 @@ Handlebars.VM = {
|
||||
};
|
||||
},
|
||||
noop: function() { return ""; },
|
||||
compile: function(string, options) {
|
||||
var ast = Handlebars.parse(string);
|
||||
var environment = new Handlebars.Compiler().compile(ast, options);
|
||||
// Yes this is evil. Work in progress for the best way to handle runtime comp vs. cached comp.
|
||||
var logic = eval('(' + new Handlebars.JavaScriptCompiler().compile(environment, options) + ')');
|
||||
return Handlebars.VM.generateContainer(logic);
|
||||
},
|
||||
invokePartial: function(partial, name, context, helpers, partials) {
|
||||
if(partial === undefined) {
|
||||
throw new Handlebars.Exception("The partial " + name + " could not be found");
|
||||
@@ -85,6 +78,7 @@ Handlebars.VM = {
|
||||
}
|
||||
};
|
||||
|
||||
Handlebars.compile = Handlebars.VM.compile;
|
||||
Handlebars.template = Handlebars.VM.template;
|
||||
|
||||
// END(BROWSER)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user