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

ignore equal signs if not forming a set delimiter

tags/0.5.0-vsc
thegrandpoobah 16 лет назад
Родитель
Сommit
180c02e641
2 измененных файлов: 24 добавлений и 3 удалений
  1. +1
    -1
      mustache.js
  2. +23
    -2
      test/unit.js

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

@@ -174,7 +174,7 @@ var Mustache = function() {
var that = this;

var new_regex = function() {
return new RegExp(that.escaped_otag + "(!|>|\\{|&|%)?([^\\/#\\^]+?)\\1?" +
return new RegExp(that.escaped_otag + "(!|>|\\{|&|%)?([^\\/#\\^=]+?)\\1?" +
that.escaped_ctag + "+", "g");
};



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

@@ -1,5 +1,5 @@
test("Parser", function() {
expect(2);
expect(3);

// matches whitespace_partial.html
equals(
@@ -38,6 +38,16 @@ test("Parser", function() {
'Hello\n\n\nWorld\n',
'Preservation of white space'
);
equals(
Mustache.to_html(
'{{=tag1}}',
{ tag1: 'Hello' },
{}
),
'{{=tag1}}',
'ignore equal sign'
);
});

test("Basic Variables", function() {
@@ -248,7 +258,7 @@ test("'^' (Inverted Section)", function() {
});

test("'>' (Partials)", function() {
expect(4);
expect(5);
// matches view_partial.html
equals(
@@ -327,6 +337,17 @@ test("'>' (Partials)", function() {
),
'1\n1.1\n1.1.1\n\n\n'
);
try {
Mustache.to_html(
'{{>partial}}',
{},
{partal: ''}
);
ok(false);
} catch(e) {
equals(e.message, "unknown_partial 'partial'");
}
});

test("'=' (Set Delimiter)", function() {


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