From 9e5ef08fbfe65e5b8b5fbfa643e1e32492a5cb67 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Mon, 15 Apr 2013 19:50:59 -0700 Subject: [PATCH 1/6] Reformat LICENSE file. --- LICENSE | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/LICENSE b/LICENSE index 63c95ac..6db5300 100644 --- a/LICENSE +++ b/LICENSE @@ -1,22 +1,20 @@ +The MIT License (MIT) Copyright (c) 2010 Justin Hileman -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. From cdcfeed67d2417e83bb6e197d21ee5b101fbd73e Mon Sep 17 00:00:00 2001 From: Josh Butts Date: Tue, 23 Apr 2013 22:53:12 -0500 Subject: [PATCH 2/6] set default value for render context to empty array --- src/Mustache/Engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index adb0c0e..90e86aa 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -165,7 +165,7 @@ class Mustache_Engine * * @return string Rendered template */ - public function render($template, $data) + public function render($template, $data = array()) { return $this->loadTemplate($template)->render($data); } From 3fb7fdc2aca99c41342411d237c26c076afa8d0b Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 23 Apr 2013 21:13:33 -0700 Subject: [PATCH 3/6] Update docs, variable name for render passthrough. --- src/Mustache/Engine.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index 90e86aa..f16f315 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -161,13 +161,13 @@ class Mustache_Engine * @see Mustache_Template::render * * @param string $template - * @param mixed $data + * @param mixed $context (default: array()) * * @return string Rendered template */ - public function render($template, $data = array()) + public function render($template, $context = array()) { - return $this->loadTemplate($template)->render($data); + return $this->loadTemplate($template)->render($context); } /** From 5d186b134b516e41da0ded7045c2fe41de1d57b6 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 23 Apr 2013 21:14:37 -0700 Subject: [PATCH 4/6] Fix this mention too :) --- src/Mustache/Engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index f16f315..2e964db 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -155,7 +155,7 @@ class Mustache_Engine /** * Shortcut 'render' invocation. * - * Equivalent to calling `$mustache->loadTemplate($template)->render($data);` + * Equivalent to calling `$mustache->loadTemplate($template)->render($context);` * * @see Mustache_Engine::loadTemplate * @see Mustache_Template::render From 2327f3839f4ec485764982c68545ab61a14ac063 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Wed, 24 Apr 2013 09:24:27 -0700 Subject: [PATCH 5/6] Fix tokenizing when `mbstring.func_overload` enabled. Fixes #144 --- src/Mustache/Tokenizer.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Mustache/Tokenizer.php b/src/Mustache/Tokenizer.php index 3b9e69a..ab11a04 100644 --- a/src/Mustache/Tokenizer.php +++ b/src/Mustache/Tokenizer.php @@ -107,10 +107,11 @@ class Mustache_Tokenizer $this->flushBuffer(); $this->state = self::IN_TAG_TYPE; } else { - if ($text[$i] == "\n") { + $char = substr($text, $i, 1); + if ($char == "\n") { $this->filterLine(); } else { - $this->buffer .= $text[$i]; + $this->buffer .= $char; } } break; @@ -118,8 +119,9 @@ class Mustache_Tokenizer case self::IN_TAG_TYPE: $i += strlen($this->otag) - 1; - if (isset(self::$tagTypes[$text[$i + 1]])) { - $tag = $text[$i + 1]; + $char = substr($text, $i + 1, 1); + if (isset(self::$tagTypes[$char])) { + $tag = $char; $this->tagType = $tag; } else { $tag = null; @@ -166,7 +168,7 @@ class Mustache_Tokenizer } } } else { - $this->buffer .= $text[$i]; + $this->buffer .= substr($text, $i, 1); } break; } From afc20ae1e23b586e63c323682aa7db7bbeef9915 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Thu, 25 Apr 2013 08:23:21 -0700 Subject: [PATCH 6/6] Bump to v2.3.1 --- src/Mustache/Engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index 2e964db..5f92d19 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -23,7 +23,7 @@ */ class Mustache_Engine { - const VERSION = '2.3.0'; + const VERSION = '2.3.1'; const SPEC_VERSION = '1.1.2'; const PRAGMA_FILTERS = 'FILTERS';