Add partial hash parser support

This commit is contained in:
kpdecker
2014-01-17 16:31:59 -06:00
parent 93a3725480
commit f90981adf6
5 changed files with 19 additions and 4 deletions
+2 -1
View File
@@ -97,11 +97,12 @@ var AST = {
// pass or at runtime.
},
PartialNode: function(partialName, context, strip, locInfo) {
PartialNode: function(partialName, context, hash, strip, locInfo) {
LocationInfo.call(this, locInfo);
this.type = "partial";
this.partialName = partialName;
this.context = context;
this.hash = hash;
this.strip = strip;
},
+6 -1
View File
@@ -82,7 +82,12 @@ PrintVisitor.prototype.mustache = function(mustache) {
PrintVisitor.prototype.partial = function(partial) {
var content = this.accept(partial.partialName);
if(partial.context) { content = content + " " + this.accept(partial.context); }
if(partial.context) {
content += " " + this.accept(partial.context);
}
if (partial.hash) {
content += " " + this.accept(partial.hash);
}
return this.pad("{{> " + content + " }}");
};