Fix #2157 (issues with = in template args)

This commit is contained in:
David Greenspan
2014-05-27 15:59:38 -07:00
parent ec4b9fb3e8
commit e4ebeda175
2 changed files with 6 additions and 1 deletions

View File

@@ -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', '=']]});
});

View File

@@ -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];