Merge branch 'release/2.3.1'
This commit is contained in:
@@ -1,22 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
Copyright (c) 2010 Justin Hileman
|
Copyright (c) 2010 Justin Hileman
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
obtaining a copy of this software and associated documentation
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
files (the "Software"), to deal in the Software without
|
in the Software without restriction, including without limitation the rights
|
||||||
restriction, including without limitation the rights to use,
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
copies of the Software, and to permit persons to whom the
|
furnished to do so, subject to the following conditions:
|
||||||
Software is furnished to do so, subject to the following
|
|
||||||
conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
The above copyright notice and this permission notice shall be included in all
|
||||||
included in all copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Engine
|
class Mustache_Engine
|
||||||
{
|
{
|
||||||
const VERSION = '2.3.0';
|
const VERSION = '2.3.1';
|
||||||
const SPEC_VERSION = '1.1.2';
|
const SPEC_VERSION = '1.1.2';
|
||||||
|
|
||||||
const PRAGMA_FILTERS = 'FILTERS';
|
const PRAGMA_FILTERS = 'FILTERS';
|
||||||
@@ -155,19 +155,19 @@ class Mustache_Engine
|
|||||||
/**
|
/**
|
||||||
* Shortcut 'render' invocation.
|
* 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_Engine::loadTemplate
|
||||||
* @see Mustache_Template::render
|
* @see Mustache_Template::render
|
||||||
*
|
*
|
||||||
* @param string $template
|
* @param string $template
|
||||||
* @param mixed $data
|
* @param mixed $context (default: array())
|
||||||
*
|
*
|
||||||
* @return string Rendered template
|
* @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->flushBuffer();
|
||||||
$this->state = self::IN_TAG_TYPE;
|
$this->state = self::IN_TAG_TYPE;
|
||||||
} else {
|
} else {
|
||||||
if ($text[$i] == "\n") {
|
$char = substr($text, $i, 1);
|
||||||
|
if ($char == "\n") {
|
||||||
$this->filterLine();
|
$this->filterLine();
|
||||||
} else {
|
} else {
|
||||||
$this->buffer .= $text[$i];
|
$this->buffer .= $char;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -118,8 +119,9 @@ class Mustache_Tokenizer
|
|||||||
case self::IN_TAG_TYPE:
|
case self::IN_TAG_TYPE:
|
||||||
|
|
||||||
$i += strlen($this->otag) - 1;
|
$i += strlen($this->otag) - 1;
|
||||||
if (isset(self::$tagTypes[$text[$i + 1]])) {
|
$char = substr($text, $i + 1, 1);
|
||||||
$tag = $text[$i + 1];
|
if (isset(self::$tagTypes[$char])) {
|
||||||
|
$tag = $char;
|
||||||
$this->tagType = $tag;
|
$this->tagType = $tag;
|
||||||
} else {
|
} else {
|
||||||
$tag = null;
|
$tag = null;
|
||||||
@@ -166,7 +168,7 @@ class Mustache_Tokenizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->buffer .= $text[$i];
|
$this->buffer .= substr($text, $i, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user