summaryrefslogtreecommitdiffstats
path: root/spec/parser.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/parser.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/parser.js')
-rw-r--r--spec/parser.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/parser.js b/spec/parser.js
index 3b7e3e4..4527d19 100644
--- a/spec/parser.js
+++ b/spec/parser.js
@@ -39,6 +39,12 @@ describe('parser', function() {
it('parses mustaches with - in a path', function() {
equals(astFor('{{foo-bar}}'), '{{ PATH:foo-bar [] }}\n');
});
+ it('parses mustaches with escaped [] in a path', function() {
+ equals(astFor('{{[foo[\\]]}}'), '{{ PATH:foo[] [] }}\n');
+ });
+ it('parses escaped \\\\ in path', function() {
+ equals(astFor('{{[foo\\\\]}}'), '{{ PATH:foo\\ [] }}\n');
+ });
it('parses mustaches with parameters', function() {
equals(astFor('{{foo bar}}'), '{{ PATH:foo [PATH:bar] }}\n');