Преглед на файлове

Updated section short-circuit logic to actually run when only inverted sections exist.

Justin Hileman преди 15 години
родител
ревизия
69a514916c

+ 1 - 1
Mustache.php

@@ -114,7 +114,7 @@ class Mustache {
 	 * @return string
 	 */
 	protected function renderSection($template, &$context) {
-		if (strpos($template, $this->otag . '#') === false) {
+		if (strpos($template, $this->otag . '#') === false && strpos($template, $this->otag . '^') === false) {
 			return $template;
 		}
 

+ 6 - 0
examples/inverted_double_section/InvertedDoubleSection.php

@@ -0,0 +1,6 @@
+<?php
+
+class InvertedDoubleSection extends Mustache {
+	public $t = false;
+	public $two = 'second';
+}

+ 7 - 0
examples/inverted_double_section/inverted_double_section.mustache

@@ -0,0 +1,7 @@
+{{^t}}
+  * first
+{{/t}}
+* {{two}}
+{{^t}}
+  * third
+{{/t}}

+ 3 - 0
examples/inverted_double_section/inverted_double_section.txt

@@ -0,0 +1,3 @@
+* first
+* second
+* third