From e4ebeda1759118a6ac5e7ff3d2ffae97e0d3898a Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Tue, 27 May 2014 15:59:38 -0700 Subject: [PATCH] Fix #2157 (issues with `=` in template args) --- packages/spacebars-compiler/spacebars_tests.js | 5 +++++ packages/spacebars-compiler/templatetag.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/spacebars-compiler/spacebars_tests.js b/packages/spacebars-compiler/spacebars_tests.js index 2ef521d014..dd5ecfc1b9 100644 --- a/packages/spacebars-compiler/spacebars_tests.js +++ b/packages/spacebars-compiler/spacebars_tests.js @@ -102,6 +102,8 @@ Tinytest.add("spacebars - stache tags", function (test) { run('{{foo.[]/[]}}', {type: 'DOUBLE', path: ['foo', '', ''], args: []}); + run('{{x foo.[=]}}', {type: 'DOUBLE', path: ['x'], + args: [['PATH', ['foo', '=']]]}); run('{{[].foo}}', "Path can't start with empty string"); run('{{foo null}}', {type: 'DOUBLE', path: ['foo'], @@ -159,6 +161,9 @@ Tinytest.add("spacebars - stache tags", function (test) { run('{{./this}}', "Can only use"); run('{{../this}}', "Can only use"); + run('{{foo "="}}', {type: 'DOUBLE', path: ['foo'], + args: [['STRING', '=']]}); + }); diff --git a/packages/spacebars-compiler/templatetag.js b/packages/spacebars-compiler/templatetag.js index 4616f37970..72ae2f7474 100644 --- a/packages/spacebars-compiler/templatetag.js +++ b/packages/spacebars-compiler/templatetag.js @@ -167,7 +167,7 @@ TemplateTag.parse = function (scannerOrString) { // Result is either the keyword matched, or null // if we're not at a keyword argument position. var scanArgKeyword = function () { - var match = /^([^\{\}\(\)\>#=\s]+)\s*=\s*/.exec(scanner.rest()); + var match = /^([^\{\}\(\)\>#=\s"'\[\]]+)\s*=\s*/.exec(scanner.rest()); if (match) { scanner.pos += match[0].length; return match[1];