Procházet zdrojové kódy

document pragmas

tags/0.2.3
Jan Lehnardt před 16 roky
rodič
revize
d0f6845451
1 změnil soubory, kde provedl 37 přidání a 0 odebrání
  1. +37
    -0
      README.md

+ 37
- 0
README.md Zobrazit soubor

@@ -133,6 +133,43 @@ callback to the `to_html()` call:
});


## Pragmas

Pragma tags let you alter the behaviour of mustache.js. They have the format of

{{%PRAGMANAME}}

and they accept options:

{{%PRAGMANAME option=value}}


### IMPLICIT-ITERATOR

When using a block to iterate over an enumerable (Array), mustache.js expects an
objects as enumerable items. The implicit iterator pragma enables optional behaviour
of allowing literals as enumerable items. Consider this view:

var view = {
foo: [1, 2, 3, 4, 5, "french"]
};

The following template can iterate over the member `foo`:

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

If you don't like the dot in there, the pragma accepts an option to set your own
iteration marker:

{{%IMPLICIT-ITERATOR iterator=bob}}
{{#foo}}
{{bob}}
{{/foo}}


## More Examples and Documentation

See `examples/` for more goodies and read the [original mustache docs][m]


Načítá se…
Zrušit
Uložit