From 008d6c7dcfed2e618a47ae85b9ea38290280c772 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Sat, 14 Jul 2012 01:03:22 -0700 Subject: [PATCH] Move call to parse into Renderer#compile --- mustache.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mustache.js b/mustache.js index 3f1d95b..aab62f9 100644 --- a/mustache.js +++ b/mustache.js @@ -222,6 +222,10 @@ var Mustache; }; Renderer.prototype.compile = function (tokens, tags) { + if (typeof tokens === "string") { + tokens = parse(tokens, tags); + } + var fn = compileTokens(tokens), self = this; @@ -327,10 +331,6 @@ var Mustache; * `returnBody` is true. */ function compileTokens(tokens, returnBody) { - if (typeof tokens === "string") { - tokens = parse(tokens); - } - var body = ['""']; var token, method, escape; @@ -466,8 +466,8 @@ var Mustache; */ function parse(template, tags) { tags = tags || exports.tags; - var tagRes = escapeTags(tags); + var tagRes = escapeTags(tags); var scanner = new Scanner(template); var tokens = [], // Buffer to hold the tokens