Fixed complex example to use inverted sections rather than fancy ruby-ish context swizzling (which never worked in PHP anyway).

This commit is contained in:
Justin Hileman
2010-04-26 19:01:57 -04:00
parent fc170fca11
commit 57a6aafff1
3 changed files with 2 additions and 8 deletions
-1
View File
@@ -82,7 +82,6 @@ Known Issues
------------ ------------
* Sections don't respect delimiter changes -- `delimiters` example currently fails with an "unclosed section" exception. * Sections don't respect delimiter changes -- `delimiters` example currently fails with an "unclosed section" exception.
* Since `complex` example emulates some fancy swizzling available in Ruby, it fails. Need to convert example to PHPisms (In PHP, Mustache class doesn't maintain current context stack -- available context is passed to methods via params).
* Test coverage is incomplete. * Test coverage is incomplete.
+2 -2
View File
@@ -5,9 +5,9 @@
{{#current}} {{#current}}
<li><strong>{{name}}</strong></li> <li><strong>{{name}}</strong></li>
{{/current}} {{/current}}
{{#isLink}} {{^current}}
<li><a href="{{url}}">{{name}}</a></li> <li><a href="{{url}}">{{name}}</a></li>
{{/isLink}} {{/current}}
{{/item}} {{/item}}
</ul> </ul>
{{/notEmpty}} {{/notEmpty}}
-5
View File
@@ -9,11 +9,6 @@ class Complex extends Mustache {
array('name' => 'blue', 'current' => false, 'url' => '#Blue'), array('name' => 'blue', 'current' => false, 'url' => '#Blue'),
); );
public function isLink() {
// Exploit the fact that the current iteration item is at the top of the context stack.
return $this->getVariable('current', $this->context) != true;
}
public function notEmpty() { public function notEmpty() {
return !($this->isEmpty()); return !($this->isEmpty());
} }