From faaeaf22afafbe11bb1d7f3dd84e856856c4d07e Mon Sep 17 00:00:00 2001 From: Peter Higgins Date: Wed, 14 Jul 2010 03:56:40 +0800 Subject: [PATCH 01/14] making it more dojo'y, and live in the 'proper' namespace --- mustache-dojo/mustache.js.tpl.post | 7 +++---- mustache-dojo/mustache.js.tpl.pre | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mustache-dojo/mustache.js.tpl.post b/mustache-dojo/mustache.js.tpl.post index f659e2f..d64667f 100644 --- a/mustache-dojo/mustache.js.tpl.post +++ b/mustache-dojo/mustache.js.tpl.post @@ -1,5 +1,4 @@ - d.mustache = function(template, view, partials) { - return Mustache.to_html(template, view, partials); - }; -})(dojo); \ No newline at end of file + dojox.mustache = dojo.hitch(Mustache, "to_html"); + +})(); \ No newline at end of file diff --git a/mustache-dojo/mustache.js.tpl.pre b/mustache-dojo/mustache.js.tpl.pre index ac9a308..f87f3cd 100644 --- a/mustache-dojo/mustache.js.tpl.pre +++ b/mustache-dojo/mustache.js.tpl.pre @@ -5,5 +5,5 @@ Shameless port of a shameless port See http://github.com/defunkt/mustache for more info. */ -dojo.provide("dojox.string.mustache"); -;(function(d) { +dojo.provide("dojox.mustache._base"); +(function(){ From 8e3444ab9d13b750fa4a851f8d0d6bc6feb5fbbc Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 21 Jul 2010 15:13:48 +0200 Subject: [PATCH 02/14] roll 0.3.0 --- CHANGES.md | 2 +- mustache.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c3e69da..60be170 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # mustache.js Changes -## 0.3.0 (??-??-????) +## 0.3.0 (21-07-2010) * Improved whitespace handling. * Make IMPLICIT ITERATORS a first class feature. diff --git a/mustache.js b/mustache.js index f3531e7..0996227 100644 --- a/mustache.js +++ b/mustache.js @@ -305,7 +305,7 @@ var Mustache = function() { return({ name: "mustache.js", - version: "0.3.0-dev", + version: "0.3.0", /* Turns a template and view into HTML From 286b2dc78ad4daf0dbb82acb072884fd2a39edbe Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 21 Jul 2010 15:14:43 +0200 Subject: [PATCH 03/14] next is 0.3.1 --- CHANGES.md | 2 ++ mustache.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 60be170..61cde5a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,7 @@ # mustache.js Changes +## 0.3.1 (??-??-????) + ## 0.3.0 (21-07-2010) * Improved whitespace handling. diff --git a/mustache.js b/mustache.js index 0996227..cd4fe64 100644 --- a/mustache.js +++ b/mustache.js @@ -305,7 +305,7 @@ var Mustache = function() { return({ name: "mustache.js", - version: "0.3.0", + version: "0.3.1-dev", /* Turns a template and view into HTML From 2f73ea4b76813a5c9927d0c4e6770858128a41e4 Mon Sep 17 00:00:00 2001 From: nrstott Date: Fri, 23 Jul 2010 05:05:54 +0800 Subject: [PATCH 04/14] added 'main' to package.json for npm support --- lib/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lib/package.json diff --git a/lib/package.json b/lib/package.json new file mode 100644 index 0000000..6325b4e --- /dev/null +++ b/lib/package.json @@ -0,0 +1,8 @@ +{ + "name": "mustache", + "author": "http://mustache.github.com/", + "description": "{{ mustache }} in JavaScript — Logic-less templates.", + "keywords": ["template"], + "version": "0.3.1-dev", + "main": "./mustache" +} From c6524ccde3228f516e38927e6b07de749e7ab29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Franusic?= Date: Sun, 29 Aug 2010 11:01:31 +0800 Subject: [PATCH 05/14] spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7434356..4a4da2d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Tags are always surrounded by mustaches like this `{{foobar}}`. Conditional sections begin with `{{#condition}}` and end with `{{/condition}}`. When `condition` evaluates to true, the section is rendered, -otherwise the hole block will output nothing at all. `condition` may be a +otherwise the whole block will output nothing at all. `condition` may be a function returning true/false or a simple boolean. var view = {condition: function() { From e4a7966bdc07366d827ebf0987d6f4782e1a3f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Franusic?= Date: Sun, 29 Aug 2010 11:05:17 +0800 Subject: [PATCH 06/14] More FAQurate --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a4da2d..32a4de2 100644 --- a/README.md +++ b/README.md @@ -256,7 +256,7 @@ own iteration marker: {{bob}} {{/foo}} -## FaQ +## F.A.Q. ### Why doesn’t Mustache allow dot notation like `{{variable.member}}`? From 0ae99e03ec16b0b3a6150e2449df6f22ee88b291 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 3 Oct 2010 11:20:07 +0200 Subject: [PATCH 07/14] Document `rake` build targets --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 32a4de2..deda933 100644 --- a/README.md +++ b/README.md @@ -284,3 +284,27 @@ Or just install it as a RubyGem: [m]: http://github.com/defunkt/mustache/#readme [node.js]: http://nodejs.org [couchdb]: http://couchdb.apache.org + + +## Plugins for jQuery, Dojo, Yui, CommonJS + +This repository lets you build modules for [jQuery][], [Dojo][], [Yui][] and +[CommonJS][] / [Node.js][] with the help of `rake`: + +Run `rake jquery` to get a jQuery compatible plugin file in the +`mustache-jquery/` directory. + +Run `rake dojo` to get a Dojo compatible plugin file in the `mustache-dojo/` +directory. + +Run `rake yui` to get a Yui compatible plugin file in the `mustache-yui/` +directory. + +Run `rake commonjs` to get a CommonJS compatible plugin file in the +`mustache-commonjs/` directory which you can also use with [Node.js][]. + +[jQuery]: http://jquery.com/ +[Dojo]: http://www.dojotoolkit.org/ +[Yui]: http://developer.yahoo.com/yui/ +[CommonJS]: http://www.commonjs.org/ +[Node.js]: http://nodejs.org/ From d8f25f82bd9dc0ad82199747cc5d4e7a7bcd52cb Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 24 Oct 2010 10:55:57 +0200 Subject: [PATCH 08/14] escape " as ". Closes #58 --- mustache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mustache.js b/mustache.js index cd4fe64..f7b2146 100644 --- a/mustache.js +++ b/mustache.js @@ -248,7 +248,7 @@ var Mustache = function() { switch(s) { case "&": return "&"; case "\\": return "\\\\"; - case '"': return '\"'; + case '"': return '"'; case "<": return "<"; case ">": return ">"; default: return s; From 60caed99f8e71cc04402d88d7f22d5955462b07b Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 24 Oct 2010 11:01:41 +0200 Subject: [PATCH 09/14] Escape single quotes to be HTML5 compliant. HTML tag attributes in HTML5 can use single quotes (') as delimiters. Patch by Tom Lynn. --- examples/apostrophe.html | 1 + examples/apostrophe.js | 1 + examples/apostrophe.txt | 1 + mustache.js | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 examples/apostrophe.html create mode 100644 examples/apostrophe.js create mode 100644 examples/apostrophe.txt diff --git a/examples/apostrophe.html b/examples/apostrophe.html new file mode 100644 index 0000000..e8687aa --- /dev/null +++ b/examples/apostrophe.html @@ -0,0 +1 @@ +{{apos}}{{control}} diff --git a/examples/apostrophe.js b/examples/apostrophe.js new file mode 100644 index 0000000..df69cd2 --- /dev/null +++ b/examples/apostrophe.js @@ -0,0 +1 @@ +var apostrophe = {'apos': "'", 'control':'X'}; diff --git a/examples/apostrophe.txt b/examples/apostrophe.txt new file mode 100644 index 0000000..4427c30 --- /dev/null +++ b/examples/apostrophe.txt @@ -0,0 +1 @@ +'X diff --git a/mustache.js b/mustache.js index f7b2146..e19109f 100644 --- a/mustache.js +++ b/mustache.js @@ -244,11 +244,12 @@ var Mustache = function() { */ escape: function(s) { s = String(s === null ? "" : s); - return s.replace(/&(?!\w+;)|["<>\\]/g, function(s) { + return s.replace(/&(?!\w+;)|["''<>\\]/g, function(s) { switch(s) { case "&": return "&"; case "\\": return "\\\\"; case '"': return '"'; + case "'": return '''; case "<": return "<"; case ">": return ">"; default: return s; From e72b635ca1f447f285973c65ac0f513eb19301ca Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Mon, 25 Oct 2010 13:10:50 +0200 Subject: [PATCH 10/14] one quote will do --- mustache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mustache.js b/mustache.js index e19109f..35a8976 100644 --- a/mustache.js +++ b/mustache.js @@ -244,7 +244,7 @@ var Mustache = function() { */ escape: function(s) { s = String(s === null ? "" : s); - return s.replace(/&(?!\w+;)|["''<>\\]/g, function(s) { + return s.replace(/&(?!\w+;)|["'<>\\]/g, function(s) { switch(s) { case "&": return "&"; case "\\": return "\\\\"; From d2feae3a27c5ad5e49a5312c62f62454e31b408f Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Mon, 25 Oct 2010 13:11:11 +0200 Subject: [PATCH 11/14] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index deda933..b013dd6 100644 --- a/README.md +++ b/README.md @@ -204,7 +204,7 @@ in `partials` for `winnings`. mustache.js does escape all values when using the standard double mustache syntax. Characters which will be escaped: `& \ " < >`. To disable escaping, -simply use tripple mustaches like `{{{unescaped_variable}}}`. +simply use triple mustaches like `{{{unescaped_variable}}}`. Example: Using `{{variable}}` inside a template for `5 > 2` will result in `5 > 2`, where as the usage of `{{{variable}}}` will result in `5 > 2`. From faa94ba1d4f06c716b92ef3a3b03e98553b64ef7 Mon Sep 17 00:00:00 2001 From: Tim Ruffles Date: Tue, 9 Nov 2010 19:03:44 +0800 Subject: [PATCH 12/14] Added requirejs wrapper --- Rakefile | 2 ++ mustache-requirejs/requirejs.mustache.js.tpl.post | 3 +++ mustache-requirejs/requirejs.mustache.js.tpl.pre | 6 ++++++ 3 files changed, 11 insertions(+) create mode 100644 mustache-requirejs/requirejs.mustache.js.tpl.post create mode 100644 mustache-requirejs/requirejs.mustache.js.tpl.pre diff --git a/Rakefile b/Rakefile index 4629c97..6b9f442 100644 --- a/Rakefile +++ b/Rakefile @@ -44,6 +44,8 @@ templated_build "CommonJS", :location => "lib", :extra => "package.json" templated_build "jQuery" templated_build "Dojo", :location => "dojox/string" templated_build "YUI3", :location => "yui3/mustache" +templated_build "requirejs" + def version File.read("mustache.js").match('version: "([^\"]+)",$')[1] diff --git a/mustache-requirejs/requirejs.mustache.js.tpl.post b/mustache-requirejs/requirejs.mustache.js.tpl.post new file mode 100644 index 0000000..632fd2a --- /dev/null +++ b/mustache-requirejs/requirejs.mustache.js.tpl.post @@ -0,0 +1,3 @@ + +return Mustache; +}); \ No newline at end of file diff --git a/mustache-requirejs/requirejs.mustache.js.tpl.pre b/mustache-requirejs/requirejs.mustache.js.tpl.pre new file mode 100644 index 0000000..160286d --- /dev/null +++ b/mustache-requirejs/requirejs.mustache.js.tpl.pre @@ -0,0 +1,6 @@ +/* +Shameless port of a shameless port ^ 2 +@defunkt => @janl => @aq => @voodootikigod => @timruffles + +*/ +define(function(){ From 29de9bacf5af611e8760a1927edde01a16088cb6 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 28 Nov 2010 17:00:04 +0100 Subject: [PATCH 13/14] add nexting example --- examples/nesting.html | 5 +++++ examples/nesting.js | 7 +++++++ examples/nesting.txt | 4 ++++ 3 files changed, 16 insertions(+) create mode 100644 examples/nesting.html create mode 100644 examples/nesting.js create mode 100644 examples/nesting.txt diff --git a/examples/nesting.html b/examples/nesting.html new file mode 100644 index 0000000..551366d --- /dev/null +++ b/examples/nesting.html @@ -0,0 +1,5 @@ +{{#foo}} + {{#a}} + {{b}} + {{/a}} +{{/foo}} diff --git a/examples/nesting.js b/examples/nesting.js new file mode 100644 index 0000000..1f76cd0 --- /dev/null +++ b/examples/nesting.js @@ -0,0 +1,7 @@ +var nesting = { + foo: [ + {a: {b: 1}}, + {a: {b: 2}}, + {a: {b: 3}} + ] +}; diff --git a/examples/nesting.txt b/examples/nesting.txt new file mode 100644 index 0000000..caf5afd --- /dev/null +++ b/examples/nesting.txt @@ -0,0 +1,4 @@ + 1 + 2 + 3 +