Browse Source

Make IMPLICIT ITERATORS a first class feature.

Closes #39.
tags/0.3.0
Jan Lehnardt 16 years ago
parent
commit
5c08642838
5 changed files with 5 additions and 8 deletions
  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 View File

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

+ 0
- 1
examples/array_of_strings.html View File

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

+ 0
- 2
examples/array_partial.2.html View File

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

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

+ 0
- 2
examples/array_partial.txt View File

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


1
2
3


+ 5
- 2
mustache.js View File

@@ -260,8 +260,11 @@ var Mustache = function() {
create_context: function(_context) {
if(this.is_object(_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 = {};
ctx[iterator] = _context;
return ctx;


Loading…
Cancel
Save