Add Hash arguments to simple mustaches (TODO: add Hash args to block helpers)

This commit is contained in:
tomhuda
2011-03-04 00:11:03 -08:00
parent e0aa705f71
commit ca9b9671a5
6 changed files with 105 additions and 48 deletions
+5 -2
View File
@@ -73,14 +73,17 @@ Handlebars.PrintVisitor.prototype.inverse = function(block) {
Handlebars.PrintVisitor.prototype.mustache = function(mustache) {
var params = mustache.params, paramStrings = [];
var params = mustache.params, paramStrings = [], hash;
for(var i=0, l=params.length; i<l; i++) {
paramStrings.push(this.accept(params[i]));
}
params = "[" + paramStrings.join(", ") + "]";
return this.pad("{{ " + this.accept(mustache.id) + " " + params + " }}");
hash = mustache.hash ? " " + this.accept(mustache.hash) : "";
return this.pad("{{ " + this.accept(mustache.id) + " " + params + hash + " }}");
};
Handlebars.PrintVisitor.prototype.partial = function(partial) {