Fixing testStickyDelimiters
This commit is contained in:
+8
-2
@@ -219,7 +219,6 @@ class Mustache {
|
|||||||
* @return string Rendered Mustache template.
|
* @return string Rendered Mustache template.
|
||||||
*/
|
*/
|
||||||
protected function _renderTemplate($template) {
|
protected function _renderTemplate($template) {
|
||||||
|
|
||||||
if ($section = $this->_findSection($template)) {
|
if ($section = $this->_findSection($template)) {
|
||||||
list($before, $type, $tag_name, $content, $after) = $section;
|
list($before, $type, $tag_name, $content, $after) = $section;
|
||||||
|
|
||||||
@@ -271,7 +270,7 @@ class Mustache {
|
|||||||
*/
|
*/
|
||||||
protected function _prepareSectionRegEx($otag, $ctag) {
|
protected function _prepareSectionRegEx($otag, $ctag) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'/(?:(?<=\\n)[ \\t]*)?%s(?P<type>[%s])(?P<tag_name>.+?)%s\\n?/s',
|
'/(?:(?<=\\n)[ \\t]*)?%s(?:(?P<type>[%s])(?P<tag_name>.+?)|=(?P<delims>.*?)=)%s\\n?/s',
|
||||||
preg_quote($otag, '/'),
|
preg_quote($otag, '/'),
|
||||||
self::SECTION_TYPES,
|
self::SECTION_TYPES,
|
||||||
preg_quote($ctag, '/')
|
preg_quote($ctag, '/')
|
||||||
@@ -303,6 +302,13 @@ class Mustache {
|
|||||||
$type = $matches['type'][0];
|
$type = $matches['type'][0];
|
||||||
$tag_name = trim($matches['tag_name'][0]);
|
$tag_name = trim($matches['tag_name'][0]);
|
||||||
|
|
||||||
|
if (isset($matches['delims'][0])) {
|
||||||
|
list($otag, $ctag) = explode(' ', $matches['delims'][0]);
|
||||||
|
$regEx = $this->_prepareSectionRegEx($otag, $ctag);
|
||||||
|
$search_offset = $offset + strlen($match);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$search_offset = $offset + strlen($match);
|
$search_offset = $offset + strlen($match);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user