Commit 71c975d4 by Jordi Boggiano

Fixing regression in the last commit

parent 43cee22e
......@@ -74,7 +74,7 @@ class Dwoo_Plugin_extends extends Dwoo_Plugin implements Dwoo_ICompilable
}
$inheritanceTree[] = $newParent;
if (preg_match('/^'.self::$l.'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)\s*?'.self::$r.'/i', $parent->getSource(), $match)) {
if (preg_match('/^'.self::$l.'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?'.self::$r.'/i', $parent->getSource(), $match)) {
$curPath = dirname($identifier) . DIRECTORY_SEPARATOR;
if (isset($match[2]) && $match[2] == '"') {
$file = '"'.str_replace('"', '\\"', substr($match[1], 1, -1)).'"';
......
......@@ -242,6 +242,14 @@ class FuncTests extends PHPUnit_Framework_TestCase
$this->assertEquals("<html>ThirdLevel</html>", $this->dwoo->get($tpl, array(), $this->compiler));
}
public function testExtendsWithBraces()
{
$tpl = new Dwoo_Template_File(TEST_DIRECTORY.'/resources/extends_braces/sub/test.html');
$tpl->forceCompilation();
$this->assertEquals("<html>ThirdLevel</html>", $this->dwoo->get($tpl, array(), $this->compiler));
}
public function testExtendsVariation2()
{
$tpl = new Dwoo_Template_File(TEST_DIRECTORY.'/resources/extends/root.html');
......
{extends('root.html')}
{block "content"}
SecondLevel
{/block}
\ No newline at end of file
<html>{block "content"}Root{/block}</html>
\ No newline at end of file
{extends("../home.html")}
{block "content"}
ThirdLevel
{/block}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment