Merge remote-tracking branch 'KevBurnsJr/fixing_delimiters' into feature/delimiter-cleanup
Conflicts: Mustache.php test/MustacheTest.php
This commit is contained in:
+7
-1
@@ -219,7 +219,6 @@ class Mustache {
|
||||
* @return string Rendered Mustache template.
|
||||
*/
|
||||
protected function _renderTemplate($template) {
|
||||
|
||||
if ($section = $this->_findSection($template)) {
|
||||
list($before, $type, $tag_name, $content, $after) = $section;
|
||||
|
||||
@@ -309,6 +308,13 @@ class Mustache {
|
||||
$type = $matches['type'][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);
|
||||
|
||||
switch ($type) {
|
||||
|
||||
@@ -408,7 +408,7 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
|
||||
public function testStickyDelimiters() {
|
||||
$m = new Mustache(null, array('result' => 'FAIL'));
|
||||
$this->assertEquals('{{ result }}', $m->render('{{=[[ ]]=}}{{ result }}[[={{ }}=]]'));
|
||||
$this->assertEquals('{{ result }}', $m->render('{{=[[ ]]=}}[[#result]]{{ result }}[[/result]]'));
|
||||
$this->assertEquals('{{#result}}{{/result}}', $m->render('{{=[[ ]]=}}{{#result}}{{/result}}[[={{ }}=]]'));
|
||||
$this->assertEquals('{{ result }}', $m->render('{{=[[ ]]=}}[[#result]]{{ result }}[[/result]][[={{ }}=]]'));
|
||||
$this->assertEquals('{{ result }}', $m->render('{{#result}}{{=[[ ]]=}}{{ result }}[[/result]][[^result]][[={{ }}=]][[ result ]]{{/result}}'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user