Added documentation for IMPLICIT-ITERATOR and DOT-NOTATION pragmas.

This commit is contained in:
Justin Hileman
2010-07-11 23:17:14 -04:00
parent f43012f457
commit c1cdea7bc5
+37
View File
@@ -33,7 +33,44 @@ class Mustache {
// Override charset passed to htmlentities() and htmlspecialchars(). Defaults to UTF-8.
protected $_charset = 'UTF-8';
/**
* Pragmas are macro-like directives that, when invoked, change the behavior or
* syntax of Mustache.
*
* They should be considered extremely experimental. Most likely their implementation
* will change in the future.
*/
/**
* The {{%DOT-NOTATION}} pragma allows context traversal via dots. Given the following context:
*
* $context = array('foo' => array('bar' => array('baz' => 'qux')));
*
* One could access nested properties using dot notation:
*
* {{%DOT-NOTATION}}{{foo.bar.baz}}
*
* Which would render as `qux`.
*/
const PRAGMA_DOT_NOTATION = 'DOT-NOTATION';
/**
* The {{%IMPLICIT-ITERATOR}} pragma allows access to non-associative array data in an
* iterable section:
*
* $context = array('items' => array('foo', 'bar', 'baz'));
*
* With this template:
*
* {{%IMPLICIT-ITERATOR}}{{#items}}{{.}}{{/items}}
*
* Would render as `foobarbaz`.
*
* {{%IMPLICIT-ITERATOR}} accepts an optional 'iterator' argument which allows implicit
* iterator tags other than {{.}} ...
*
* {{%IMPLICIT-ITERATOR iterator=i}}{{#items}}{{i}}{{/items}}
*/
const PRAGMA_IMPLICIT_ITERATOR = 'IMPLICIT-ITERATOR';
/**