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

Make IMPLICIT ITERATORS a first class feature.

Closes #39.
tags/0.3.0
Jan Lehnardt 16 лет назад
Родитель
Сommit
5c08642838
5 измененных файлов: 5 добавлений и 8 удалений
  1. +0
    -1
      examples/array_of_partials_implicit_partial.html
  2. +0
    -1
      examples/array_of_strings.html
  3. +0
    -2
      examples/array_partial.2.html
  4. +0
    -2
      examples/array_partial.txt
  5. +5
    -2
      mustache.js

+ 0
- 1
examples/array_of_partials_implicit_partial.html Просмотреть файл

@@ -1,5 +1,4 @@
Here is some stuff! Here is some stuff!
{{%IMPLICIT-ITERATOR}}
{{#numbers}} {{#numbers}}
{{>partial}} {{>partial}}
{{/numbers}} {{/numbers}}

+ 0
- 1
examples/array_of_strings.html Просмотреть файл

@@ -1,2 +1 @@
{{%IMPLICIT-ITERATOR}}
{{#array_of_strings}} {{.}} {{/array_of_strings}} {{#array_of_strings}} {{.}} {{/array_of_strings}}

+ 0
- 2
examples/array_partial.2.html Просмотреть файл

@@ -1,6 +1,4 @@
Here's a non-sense array of values Here's a non-sense array of values

{{%IMPLICIT-ITERATOR}}
{{#array}} {{#array}}
{{.}} {{.}}
{{/array}} {{/array}}

+ 0
- 2
examples/array_partial.txt Просмотреть файл

@@ -1,6 +1,4 @@
Here's a non-sense array of values Here's a non-sense array of values


1 1
2 2
3 3


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

@@ -260,8 +260,11 @@ var Mustache = function() {
create_context: function(_context) { create_context: function(_context) {
if(this.is_object(_context)) { if(this.is_object(_context)) {
return _context; return _context;
} else if(this.pragmas["IMPLICIT-ITERATOR"]) {
var iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator || ".";
} else {
var iterator = ".";
if(this.pragmas["IMPLICIT-ITERATOR"]) {
iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator;
}
var ctx = {}; var ctx = {};
ctx[iterator] = _context; ctx[iterator] = _context;
return ctx; return ctx;


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