diff --git a/CHANGES.md b/CHANGES.md index c3e69da..61cde5a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ # mustache.js Changes -## 0.3.0 (??-??-????) +## 0.3.1 (??-??-????) + +## 0.3.0 (21-07-2010) * Improved whitespace handling. * Make IMPLICIT ITERATORS a first class feature. diff --git a/README.md b/README.md index 7434356..b013dd6 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() { @@ -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`. @@ -256,7 +256,7 @@ own iteration marker: {{bob}} {{/foo}} -## FaQ +## F.A.Q. ### Why doesn’t Mustache allow dot notation like `{{variable.member}}`? @@ -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/ 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/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/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 + 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" +} 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(){ 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(){