Просмотр исходного кода

merge with janl's branch

tags/0.5.0-vsc
thegrandpoobah 15 лет назад
Родитель
Сommit
9cdcb82116
14 измененных файлов: 73 добавлений и 10 удалений
  1. +3
    -1
      CHANGES.md
  2. +27
    -3
      README.md
  3. +2
    -0
      Rakefile
  4. +1
    -0
      examples/apostrophe.html
  5. +1
    -0
      examples/apostrophe.js
  6. +1
    -0
      examples/apostrophe.txt
  7. +5
    -0
      examples/nesting.html
  8. +7
    -0
      examples/nesting.js
  9. +4
    -0
      examples/nesting.txt
  10. +8
    -0
      lib/package.json
  11. +3
    -4
      mustache-dojo/mustache.js.tpl.post
  12. +2
    -2
      mustache-dojo/mustache.js.tpl.pre
  13. +3
    -0
      mustache-requirejs/requirejs.mustache.js.tpl.post
  14. +6
    -0
      mustache-requirejs/requirejs.mustache.js.tpl.pre

+ 3
- 1
CHANGES.md Просмотреть файл

@@ -1,6 +1,8 @@
# mustache.js Changes # mustache.js Changes


## 0.3.0 (??-??-????)
## 0.3.1 (??-??-????)

## 0.3.0 (21-07-2010)


* Improved whitespace handling. * Improved whitespace handling.
* Make IMPLICIT ITERATORS a first class feature. * Make IMPLICIT ITERATORS a first class feature.


+ 27
- 3
README.md Просмотреть файл

@@ -58,7 +58,7 @@ Tags are always surrounded by mustaches like this `{{foobar}}`.


Conditional sections begin with `{{#condition}}` and end with Conditional sections begin with `{{#condition}}` and end with
`{{/condition}}`. When `condition` evaluates to true, the section is rendered, `{{/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. function returning true/false or a simple boolean.


var view = {condition: function() { var view = {condition: function() {
@@ -204,7 +204,7 @@ in `partials` for `winnings`.


mustache.js does escape all values when using the standard double mustache mustache.js does escape all values when using the standard double mustache
syntax. Characters which will be escaped: `& \ " < >`. To disable escaping, 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 &gt; 2`, where as the usage of `{{{variable}}}` will result in `5 > 2`. Example: Using `{{variable}}` inside a template for `5 > 2` will result in `5 &gt; 2`, where as the usage of `{{{variable}}}` will result in `5 > 2`.


@@ -256,7 +256,7 @@ own iteration marker:
{{bob}} {{bob}}
{{/foo}} {{/foo}}


## FaQ
## F.A.Q.


### Why doesn’t Mustache allow dot notation like `{{variable.member}}`? ### 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 [m]: http://github.com/defunkt/mustache/#readme
[node.js]: http://nodejs.org [node.js]: http://nodejs.org
[couchdb]: http://couchdb.apache.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/

+ 2
- 0
Rakefile Просмотреть файл

@@ -44,6 +44,8 @@ templated_build "CommonJS", :location => "lib", :extra => "package.json"
templated_build "jQuery" templated_build "jQuery"
templated_build "Dojo", :location => "dojox/string" templated_build "Dojo", :location => "dojox/string"
templated_build "YUI3", :location => "yui3/mustache" templated_build "YUI3", :location => "yui3/mustache"
templated_build "requirejs"



def version def version
File.read("mustache.js").match('version: "([^\"]+)",$')[1] File.read("mustache.js").match('version: "([^\"]+)",$')[1]


+ 1
- 0
examples/apostrophe.html Просмотреть файл

@@ -0,0 +1 @@
{{apos}}{{control}}

+ 1
- 0
examples/apostrophe.js Просмотреть файл

@@ -0,0 +1 @@
var apostrophe = {'apos': "'", 'control':'X'};

+ 1
- 0
examples/apostrophe.txt Просмотреть файл

@@ -0,0 +1 @@
&#39;X

+ 5
- 0
examples/nesting.html Просмотреть файл

@@ -0,0 +1,5 @@
{{#foo}}
{{#a}}
{{b}}
{{/a}}
{{/foo}}

+ 7
- 0
examples/nesting.js Просмотреть файл

@@ -0,0 +1,7 @@
var nesting = {
foo: [
{a: {b: 1}},
{a: {b: 2}},
{a: {b: 3}}
]
};

+ 4
- 0
examples/nesting.txt Просмотреть файл

@@ -0,0 +1,4 @@
1
2
3

+ 8
- 0
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"
}

+ 3
- 4
mustache-dojo/mustache.js.tpl.post Просмотреть файл

@@ -1,5 +1,4 @@


d.mustache = function(template, view, partials) {
return Mustache.to_html(template, view, partials);
};
})(dojo);
dojox.mustache = dojo.hitch(Mustache, "to_html");

})();

+ 2
- 2
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. See http://github.com/defunkt/mustache for more info.
*/ */


dojo.provide("dojox.string.mustache");
;(function(d) {
dojo.provide("dojox.mustache._base");
(function(){

+ 3
- 0
mustache-requirejs/requirejs.mustache.js.tpl.post Просмотреть файл

@@ -0,0 +1,3 @@

return Mustache;
});

+ 6
- 0
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(){

Загрузка…
Отмена
Сохранить