From 69a514916cc3b1f1780da633d4a2b749004913c5 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Mon, 26 Apr 2010 23:19:20 -0400 Subject: [PATCH] Updated section short-circuit logic to actually run when only inverted sections exist. --- Mustache.php | 2 +- examples/inverted_double_section/InvertedDoubleSection.php | 6 ++++++ .../inverted_double_section.mustache | 7 +++++++ .../inverted_double_section/inverted_double_section.txt | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 examples/inverted_double_section/InvertedDoubleSection.php create mode 100644 examples/inverted_double_section/inverted_double_section.mustache create mode 100644 examples/inverted_double_section/inverted_double_section.txt diff --git a/Mustache.php b/Mustache.php index 48b4e1b..01f16ee 100644 --- a/Mustache.php +++ b/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; } diff --git a/examples/inverted_double_section/InvertedDoubleSection.php b/examples/inverted_double_section/InvertedDoubleSection.php new file mode 100644 index 0000000..3dc2231 --- /dev/null +++ b/examples/inverted_double_section/InvertedDoubleSection.php @@ -0,0 +1,6 @@ +