Просмотр исходного кода

Missing global flag on regex in pragma interpreter

tags/0.5.0-vsc
Sahab Yazdani 15 лет назад
Родитель
Сommit
368b4c30de
2 измененных файлов: 16 добавлений и 1 удалений
  1. +1
    -1
      mustache.js
  2. +15
    -0
      test/unit.js

+ 1
- 1
mustache.js Просмотреть файл

@@ -273,7 +273,7 @@ var Mustache = (function(undefined) {
return state.template; return state.template;
} }


state.template = state.template.replace(/{{%([\w-]+)(\s*)(.*?(?=}}))}}/, function(match, pragma, space, suffix) {
state.template = state.template.replace(/{{%([\w-]+)(\s*)(.*?(?=}}))}}/g, function(match, pragma, space, suffix) {
var options = undefined, var options = undefined,
optionPairs, scratch, optionPairs, scratch,
i, n; i, n;


+ 15
- 0
test/unit.js Просмотреть файл

@@ -511,6 +511,21 @@ test("'%' (Pragmas)", function() {
), ),
"Object 1:Object 2:Object 3:", "Object 1:Object 2:Object 3:",
'Change Delimiter and Pragma mixes' 'Change Delimiter and Pragma mixes'
);


raises(
function() {
Mustache.to_html(
'{{%IMPLICIT-ITERATOR iterator=rob}}{{%I-HAVE-THE-GREATEST-MUSTACHE}}',
{},
{}
);
},
function(e) {
return e.message === 'This implementation of mustache does not implement the "I-HAVE-THE-GREATEST-MUSTACHE" pragma.';
},
'Multiple Pragmas'
); );
}); });




Загрузка…
Отмена
Сохранить