From d6068505a322a1bc9e80951466c450b637970388 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Fri, 13 Jul 2012 22:43:38 -0700 Subject: [PATCH 1/4] Fix subtle IE7 bug Fixes #223 --- mustache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mustache.js b/mustache.js index 75f98ac..903e895 100644 --- a/mustache.js +++ b/mustache.js @@ -497,7 +497,7 @@ var Mustache; if (value) { for (var i = 0, len = value.length; i < len; ++i) { - chr = value[i]; + chr = value.charAt(i); if (isWhitespace(chr)) { spaces.push(tokens.length); From e30455533341db99ec9449ded4a15e2e4a528f34 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Fri, 13 Jul 2012 23:16:30 -0700 Subject: [PATCH 2/4] Fix null section data Fixes #222 --- mustache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mustache.js b/mustache.js index 903e895..3f1d95b 100644 --- a/mustache.js +++ b/mustache.js @@ -261,7 +261,7 @@ var Mustache; return buffer; } - return callback(context.push(value), this); + return value ? callback(context.push(value), this) : ""; case "function": // TODO: The text should be passed to the callback plain, not rendered. var sectionText = callback(context, this), From 008d6c7dcfed2e618a47ae85b9ea38290280c772 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Sat, 14 Jul 2012 01:03:22 -0700 Subject: [PATCH 3/4] 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 From fe3de766cda7cafbc2b169d985ab665e18a416ce Mon Sep 17 00:00:00 2001 From: fisch42 Date: Sun, 22 Jul 2012 13:56:50 +0300 Subject: [PATCH 4/4] added .js to main property in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a3ae822..0de2b51 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Logic-less {{mustache}} templates with JavaScript", "author": "mustache.js Authors ", "keywords": ["mustache", "template", "templates", "ejs"], - "main": "./mustache", + "main": "./mustache.js", "devDependencies": { "vows": "0.6.x", "uglify-js": "1.3.0"