| @@ -18,10 +18,12 @@ var Mustache = function() { | |||||
| context: {}, | context: {}, | ||||
| render: function(template, context, partials, in_recursion) { | render: function(template, context, partials, in_recursion) { | ||||
| // reset buffer | |||||
| // TODO: make this non-lazy | |||||
| if(!in_recursion) | |||||
| this.buffer = []; | |||||
| // reset buffer & set context | |||||
| if(!in_recursion) { | |||||
| this.context = context; | |||||
| this.buffer = []; // TODO: make this non-lazy | |||||
| } | |||||
| // fail fast | // fail fast | ||||
| if(!this.includes("", template)) { | if(!this.includes("", template)) { | ||||
| if(in_recursion) { | if(in_recursion) { | ||||
| @@ -32,11 +34,6 @@ var Mustache = function() { | |||||
| } | } | ||||
| } | } | ||||
| if(!in_recursion) { | |||||
| this.context = context; | |||||
| this.buffer = []; | |||||
| } | |||||
| template = this.render_pragmas(template); | template = this.render_pragmas(template); | ||||
| var html = this.render_section(template, context, partials); | var html = this.render_section(template, context, partials); | ||||
| if(in_recursion) { | if(in_recursion) { | ||||