summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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 'src')
-rw-r--r--src/handlebars.l1
-rw-r--r--src/handlebars.yy7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/handlebars.l b/src/handlebars.l
index f7df8f5..39a7884 100644
--- a/src/handlebars.l
+++ b/src/handlebars.l
@@ -80,6 +80,7 @@ ID [^\s!"#%-,\.\/;->@\[-\^`\{-~]+/{LOOKAHEAD}
return 'CLOSE_RAW_BLOCK';
}
<mu>"{{"{LEFT_STRIP}?">" return 'OPEN_PARTIAL';
+<mu>"{{"{LEFT_STRIP}?"#>" return 'OPEN_PARTIAL_BLOCK';
<mu>"{{"{LEFT_STRIP}?"#" return 'OPEN_BLOCK';
<mu>"{{"{LEFT_STRIP}?"/" return 'OPEN_ENDBLOCK';
<mu>"{{"{LEFT_STRIP}?"^"\s*{RIGHT_STRIP}?"}}" this.popState(); return 'INVERSE';
diff --git a/src/handlebars.yy b/src/handlebars.yy
index a05b477..e94ab51 100644
--- a/src/handlebars.yy
+++ b/src/handlebars.yy
@@ -17,6 +17,7 @@ statement
| block -> $1
| rawBlock -> $1
| partial -> $1
+ | partialBlock -> $1
| content -> $1
| COMMENT {
$$ = {
@@ -101,6 +102,12 @@ partial
};
}
;
+partialBlock
+ : openPartialBlock program closeBlock -> yy.preparePartialBlock($1, $2, $3, @$)
+ ;
+openPartialBlock
+ : OPEN_PARTIAL_BLOCK partialName param* hash? CLOSE -> { path: $2, params: $3, hash: $4, strip: yy.stripFlags($1, $5) }
+ ;
param
: helperName -> $1