summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/printer.js
diff options
context:
space:
mode:
authorKevin Decker <kpdecker@gmail.com>2015-08-23 23:45:17 -0500
committerKevin Decker <kpdecker@gmail.com>2015-08-23 23:45:17 -0500
commitc727e1f97c471ec6be26b54dcd7422fd521a2471 (patch)
tree0979b5f54c7e98b317545a573d43ec6e8566d576 /lib/handlebars/compiler/printer.js
parent2571dd8e8e43fd320672763564b16a5b3ae33966 (diff)
parent1c274088c1ea9969f7a676fd5bebd11698f73116 (diff)
downloadhandlebars.js-c727e1f97c471ec6be26b54dcd7422fd521a2471.zip
handlebars.js-c727e1f97c471ec6be26b54dcd7422fd521a2471.tar.gz
handlebars.js-c727e1f97c471ec6be26b54dcd7422fd521a2471.tar.bz2
Merge pull request #1076 from wycats/partial-block
Implement partial blocks
Diffstat (limited to 'lib/handlebars/compiler/printer.js')
-rw-r--r--lib/handlebars/compiler/printer.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/printer.js b/lib/handlebars/compiler/printer.js
index 107d4b6..cf7aa48 100644
--- a/lib/handlebars/compiler/printer.js
+++ b/lib/handlebars/compiler/printer.js
@@ -84,6 +84,22 @@ PrintVisitor.prototype.PartialStatement = function(partial) {
}
return this.pad('{{> ' + content + ' }}');
};
+PrintVisitor.prototype.PartialBlockStatement = function(partial) {
+ let content = 'PARTIAL BLOCK:' + partial.name.original;
+ if (partial.params[0]) {
+ content += ' ' + this.accept(partial.params[0]);
+ }
+ if (partial.hash) {
+ content += ' ' + this.accept(partial.hash);
+ }
+
+ content += ' ' + this.pad('PROGRAM:');
+ this.padding++;
+ content += this.accept(partial.program);
+ this.padding--;
+
+ return this.pad('{{> ' + content + ' }}');
+};
PrintVisitor.prototype.ContentStatement = function(content) {
return this.pad("CONTENT[ '" + content.value + "' ]");