summaryrefslogtreecommitdiffstats
path: root/spec/tokenizer.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2015-09-16 16:11:56 -0500
committerkpdecker <kpdecker@gmail.com>2015-09-16 16:15:01 -0500
commit08781798f564a68abee11c74e2b98272657b2a56 (patch)
tree0f725f743bb28cbc7ada747132edab483c9c5649 /spec/tokenizer.js
parent641fe335df78c436aecf5e7173fde529f72ac2f8 (diff)
downloadhandlebars.js-08781798f564a68abee11c74e2b98272657b2a56.zip
handlebars.js-08781798f564a68abee11c74e2b98272657b2a56.tar.gz
handlebars.js-08781798f564a68abee11c74e2b98272657b2a56.tar.bz2
Allow for escaped ] characters in [] IDs
Allows for ] literal characters to be used within [] IDs by prefixing them with the \ character. `\` literal at the end of the may be referenced by the `\\` sequence if conflicting. Under most circumstances the `\\` sequence will continue to work. Potentially breaking change for users of [] ids that have `\\` anywhere in the id or `\` at the end of the id. Fixes #1092
Diffstat (limited to 'spec/tokenizer.js')
-rw-r--r--spec/tokenizer.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/tokenizer.js b/spec/tokenizer.js
index dc077ce..428804e 100644
--- a/spec/tokenizer.js
+++ b/spec/tokenizer.js
@@ -146,6 +146,11 @@ describe('Tokenizer', function() {
shouldMatchTokens(result, ['OPEN', 'ID', 'SEP', 'ID', 'CLOSE', 'OPEN', 'ID', 'SEP', 'ID', 'CLOSE']);
});
+ it('allows escaped literals in []', function() {
+ var result = tokenize('{{foo.[bar\\]]}}');
+ shouldMatchTokens(result, ['OPEN', 'ID', 'SEP', 'ID', 'CLOSE']);
+ });
+
it('tokenizes {{.}} as OPEN ID CLOSE', function() {
var result = tokenize('{{.}}');
shouldMatchTokens(result, ['OPEN', 'ID', 'CLOSE']);