Skip to content

Commit

Permalink
Fixed a major bug in includes
Browse files Browse the repository at this point in the history
- Fixed a bug where the extensions in the compiler where checked without
the .-prefix in handleImport (#48)
  • Loading branch information
TorbenKoehn committed Jan 16, 2016
1 parent 0c9b815 commit 5be2418
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 34 deletions.
11 changes: 3 additions & 8 deletions Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Compiler.html
* @since File available since Release 1.0
*/
Expand Down Expand Up @@ -91,7 +91,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Compiler.html
* @since File available since Release 1.0
*/
Expand Down Expand Up @@ -1000,7 +1000,7 @@ protected function handleImport(Node $node)
$ext = array_search($node->filter, $this->_options['filterMap']);
}

if (!empty($ext) && (!in_array($ext, $this->_options['extensions']) || $node->filter)) {
if (!empty($ext) && (!in_array(".$ext", $this->_options['extensions']) || $node->filter)) {

if (!$node->filter && isset($this->_options['filterMap'][$ext]))
$node->filter = $this->_options['filterMap'][$ext];
Expand Down Expand Up @@ -1210,11 +1210,6 @@ protected function handleMixins(Node $node)
protected function handleMixin(Node $node)
{

//Find the absolute document root
$root = $node;
while ($root->parent)
$root = $root->parent;

//Detach
$node->parent->remove($node);

Expand Down
4 changes: 2 additions & 2 deletions Compiler/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Compiler.Exception.html
* @since File available since Release 1.0
*/
Expand All @@ -35,7 +35,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Compiler.Exception.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Filter.html
* @since File available since Release 1.0
*/
Expand Down Expand Up @@ -53,7 +53,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Filter.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Lexer.html
* @since File available since Release 1.0
*/
Expand Down Expand Up @@ -60,7 +60,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Lexer.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Lexer/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Lexer.Exception.html
* @since File available since Release 1.0
*/
Expand All @@ -34,7 +34,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Lexer.Exception.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Parser.html
* @since File available since Release 1.0
*/
Expand Down Expand Up @@ -57,7 +57,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Parser.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Parser/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Parser.Exception.html
* @since File available since Release 1.0
*/
Expand All @@ -34,7 +34,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Parser.Exception.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Parser/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Parser.Node.html
* @since File available since Release 1.0
*/
Expand All @@ -40,7 +40,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Parser.Node.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Renderer.html
* @since File available since Release 1.0
*/
Expand Down Expand Up @@ -51,7 +51,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Renderer.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Renderer/Adapter/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Renderer.Adapter.File.html
* @since File available since Release 1.0
*/
Expand Down Expand Up @@ -59,7 +59,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Renderer.Adapter.File.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Renderer/Adapter/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Renderer.Adapter.Stream.html
* @since File available since Release 1.0
*/
Expand Down Expand Up @@ -70,7 +70,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Renderer.Adapter.Stream.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Renderer/Adapter/Stream/Wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Renderer.Adapter.Stream.Wrapper.html
* @since File available since Release 1.0
*/
Expand All @@ -42,7 +42,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Renderer.Adapter.Stream.Wrapper.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 2 additions & 2 deletions Renderer/AdapterBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/Renderer.AdapterBase.html
* @since File available since Release 1.0
*/
Expand All @@ -41,7 +41,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/classes/Tale.Jade.Renderer.AdapterBase.html
* @since File available since Release 1.0
*/
Expand Down
4 changes: 4 additions & 0 deletions Test/IssueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ public function testIssue48()
$this->assertEquals('<h2>Hello</h2>', $this->_renderer->render(
'issue-48/1'
));

$this->assertEquals(' <button>Submit</button>', $this->_renderer->render(
'issue-48/views/view.ctp'
));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

mixin button_with_preloader(title)
button= $title
6 changes: 6 additions & 0 deletions Test/views/issues/issue-48/views/view.ctp.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

include ../Mixins/button_with_preloader.ctp.jade

<?php function ___($str) { return $str; } ?>

+button_with_preloader(___('Submit'))#btn_submit_feedback.right._no-margin-bottom
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Talesoft <info@talesoft.io>
* @copyright Copyright (c) 2015 Talesoft (http://talesoft.io)
* @license http://licenses.talesoft.io/2015/MIT.txt MIT License
* @version 1.3.4
* @version 1.3.5
* @link http://jade.talesoft.io/docs/files/functions.html
* @since File available since Tag 1.0.1
*/
Expand Down
2 changes: 1 addition & 1 deletion tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'./.git'
];

$newVersion = '1.3.4';
$newVersion = '1.3.5';


if (!$newVersion) {
Expand Down

0 comments on commit 5be2418

Please sign in to comment.