Parcourir la source

Merge remote-tracking branch 'upstream/master'

tags/0.5.2
Michael Jackson il y a 13 ans
Parent
révision
dbf609fd37
2 fichiers modifiés avec 8 ajouts et 8 suppressions
  1. +7
    -7
      mustache.js
  2. +1
    -1
      package.json

+ 7
- 7
mustache.js Voir le fichier

@@ -221,6 +221,10 @@ var Mustache;
};

Renderer.prototype.compile = function (tokens, tags) {
if (typeof tokens === "string") {
tokens = parse(tokens, tags);
}

var fn = compileTokens(tokens),
self = this;

@@ -260,7 +264,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),
@@ -326,10 +330,6 @@ var Mustache;
* `returnBody` is true.
*/
function compileTokens(tokens, returnBody) {
if (typeof tokens === "string") {
tokens = parse(tokens);
}

var body = ['""'];
var token, method, escape;

@@ -465,8 +465,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
@@ -496,7 +496,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);


+ 1
- 1
package.json Voir le fichier

@@ -4,7 +4,7 @@
"description": "Logic-less {{mustache}} templates with JavaScript",
"author": "mustache.js Authors <http://github.com/janl/mustache.js>",
"keywords": ["mustache", "template", "templates", "ejs"],
"main": "./mustache",
"main": "./mustache.js",
"devDependencies": {
"vows": "0.6.x",
"uglify-js": "1.3.0"


Chargement…
Annuler
Enregistrer