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

Change delimiter should honour pragmas

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

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

@@ -398,6 +398,7 @@ var Mustache = (function(undefined) {
, state.partials
);
new_state.metrics.partial = variable;
// TODO: Determine if partials should inherit pragma state from parent
program = compile(new_state);
state.partials[variable] = function(context, send_func) {
@@ -552,6 +553,7 @@ var Mustache = (function(undefined) {
new_state.metrics.character = state.metrics.character + token.length;
new_state.metrics.partial = state.metrics.partial;
new_state.section = state.section;
new_state.pragmas = state.pragmas;
if (new_state.section) {
new_state.section.template_buffer.push(token);
}


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

@@ -499,8 +499,19 @@ test("'%' (Pragmas)", function() {
{ dataSet: [ 'Object 1', 'Object 2', 'Object 3' ] },
{}
),
"Object 1:Object 2:Object 3:"
"Object 1:Object 2:Object 3:",
'Default behaviour for IMPLICIT ITERATOR'
);
equals(
Mustache.to_html(
'{{%IMPLICIT-ITERATOR iterator=rob}}{{=<% %>=}}<%#dataSet%><%rob%>:<%/dataSet%>',
{ dataSet: [ 'Object 1', 'Object 2', 'Object 3' ] },
{}
),
"Object 1:Object 2:Object 3:",
'Change Delimiter and Pragma mixes'
);
});

test("Empty", function() {


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