diff --git a/lib/handlebars.js b/lib/handlebars.js index 9c5e7a95..c744046c 100644 --- a/lib/handlebars.js +++ b/lib/handlebars.js @@ -4,7 +4,6 @@ var Handlebars = { compile: function(string) { if (Handlebars.compilerCache[string] == null) { var fnBody = Handlebars.compileFunctionBody(string); - console.log(fnBody); var fn = new Function("context", "fallback", "stack", "Handlebars", fnBody); Handlebars.compilerCache[string] = function(context, fallback, stack) { return fn(context, fallback, stack, Handlebars); }; @@ -235,8 +234,6 @@ Handlebars.Context.prototype = { // stack: The stack to work with evalExpression: function(path, stack) { var newContext = new Handlebars.Context(this); - console.log("--- New context:"); - console.log(newContext); var parsedPath = Handlebars.parsePath(path); var depth = parsedPath[0]; @@ -255,8 +252,6 @@ Handlebars.Context.prototype = { newContext.data = newContext.fallback[parts[0]]; } - console.log("Evaluated expression '" + path + "' to:"); - console.log(newContext); return newContext; } }; @@ -289,7 +284,6 @@ Handlebars.SafeString.prototype.toString = function() { } Handlebars.helperMissing = function(object, fn) { - console.log("HELPER MISSING"); var ret = ""; if(object.data === true) { @@ -450,8 +444,8 @@ Handlebars.Compiler.prototype = { addPartial: function(mustache, param) { // either used a cached copy of the partial or compile a new one - this.fn += "console.log(context); if (typeof context.fallback['partials'] === 'undefined' || typeof context.fallback['partials']['" + mustache + "'] === 'undefined') throw new Handlebars.Exception('Attempted to render undefined partial: " + mustache + "');"; - this.fn += "out = out + Handlebars.compilePartial(context.fallback['partials']['" + mustache + "'])(" + param + ", stack);"; + this.fn += "if (typeof context.fallback['partials'] === 'undefined' || typeof context.fallback['partials']['" + mustache + "'] === 'undefined') throw new Handlebars.Exception('Attempted to render undefined partial: " + mustache + "');"; + this.fn += "out = out + Handlebars.compilePartial(context.fallback['partials']['" + mustache + "'])(" + param + ", null, stack);"; }, parseMustache: function() { @@ -528,7 +522,7 @@ Handlebars.Compiler.prototype = { this.comment = false; return; } else if (this.partial) { - this.addPartial(mustache, arguments[0]) + this.addPartial(mustache, "(" + this.lookupFor(argument) + ")"); this.partial = false; return; } else if (this.inverted) {