Add {{{{ }}}} for raw blocks
This commit is contained in:
@@ -21,6 +21,14 @@ describe('blocks', function() {
|
||||
equal(result, "0. goodbye! 1. Goodbye! 2. GOODBYE! cruel world!", "The @index variable is used");
|
||||
});
|
||||
|
||||
|
||||
it("raw block", function() {
|
||||
var string = "{{{{ {{test}} }}}}";
|
||||
var hash = { test: "hello" };
|
||||
shouldCompileTo(string, hash, " {{test}} ",
|
||||
"raw block ignores blocks");
|
||||
});
|
||||
|
||||
it("empty block", function() {
|
||||
var string = "{{#goodbyes}}{{/goodbyes}}cruel {{world}}!";
|
||||
var hash = {goodbyes: [{text: "goodbye"}, {text: "Goodbye"}, {text: "GOODBYE"}], world: "world"};
|
||||
|
||||
@@ -54,6 +54,11 @@ ID [^\s!"#%-,\.\/;->@\[-\^`\{-~]+/{LOOKAHEAD}
|
||||
<mu>"(" return 'OPEN_SEXPR';
|
||||
<mu>")" return 'CLOSE_SEXPR';
|
||||
|
||||
<mu>"{{{{"[^\x00]*"}}}}" {
|
||||
yytext = yytext.substr(4, yyleng-8);
|
||||
this.popState();
|
||||
return 'RAW_BLOCK';
|
||||
}
|
||||
<mu>"{{"{LEFT_STRIP}?">" return 'OPEN_PARTIAL';
|
||||
<mu>"{{"{LEFT_STRIP}?"#" return 'OPEN_BLOCK';
|
||||
<mu>"{{"{LEFT_STRIP}?"/" return 'OPEN_ENDBLOCK';
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@ statements
|
||||
;
|
||||
|
||||
statement
|
||||
: openInverse program closeBlock -> new yy.BlockNode($1, $2.inverse, $2, $3, @$)
|
||||
: RAW_BLOCK { $$ = new yy.ContentNode($1, @$); }
|
||||
| openInverse program closeBlock -> new yy.BlockNode($1, $2.inverse, $2, $3, @$)
|
||||
| openBlock program closeBlock -> new yy.BlockNode($1, $2, $2.inverse, $3, @$)
|
||||
| mustache -> $1
|
||||
| partial -> $1
|
||||
|
||||
Reference in New Issue
Block a user