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

reintroduce {{! !}} comment syntax for backwards compatibility.

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

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

@@ -125,7 +125,7 @@ var Mustache = (function(undefined) {
return token.match(/\r?\n/)!==null;
}

var default_tokenizer = /(\r?\n)|({{![\s\S]*?}})|({{[#\^\/&{>=]?\s*\S*?\s*}?}})|({{=\S*?\s*\S*?=}})/;
var default_tokenizer = /(\r?\n)|({{![\s\S]*?!}})|({{[#\^\/&{>=]?\s*\S*?\s*}?}})|({{=\S*?\s*\S*?=}})/;
function create_parser_context(template, partials, openTag, closeTag) {
openTag = openTag || '{{';
closeTag = closeTag || '}}';
@@ -137,7 +137,7 @@ var Mustache = (function(undefined) {
var rOTag = escape_regex(openTag),
rETag = escape_regex(closeTag);

tokenizer = new RegExp('(\\r?\\n)|(' + rOTag + '![\\s\\S]*?' + rETag + ')|(' + rOTag + '[#\^\/&{>=]?\\s*\\S*?\\s*}?' + rETag + ')|(' + rOTag + '=\\S*?\\s*\\S*?=' + rETag + ')');
tokenizer = new RegExp('(\\r?\\n)|(' + rOTag + '![\\s\\S]*?!' + rETag + ')|(' + rOTag + '[#\^\/&{>=]?\\s*\\S*?\\s*}?' + rETag + ')|(' + rOTag + '=\\S*?\\s*\\S*?=' + rETag + ')');
}
var code = [];


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

@@ -412,13 +412,10 @@ test("'!' (Comments)", function() {
'',
'Multiline Comments');
/*
* According to mustache-spec, comments cannot contain the }} character, so this test is useless
equals(
Mustache.to_html('{{!this {{is}} {{#a}} {{/multiline}} comment\ni {{^said}} ! hello !! bye!}}'),
'',
'Correct tokenization');
*/

// matches comments.html
equals(


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