Merge branch 'release/2.3.1'
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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';
|
||||
@@ -155,19 +155,19 @@ 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
|
||||
*
|
||||
* @param string $template
|
||||
* @param mixed $data
|
||||
* @param mixed $context (default: array())
|
||||
*
|
||||
* @return string Rendered template
|
||||
*/
|
||||
public function render($template, $data)
|
||||
public function render($template, $context = array())
|
||||
{
|
||||
return $this->loadTemplate($template)->render($data);
|
||||
return $this->loadTemplate($template)->render($context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user