Talesoft / tale-jade

A complete and fully-functional implementation of the Jade template language for PHP
http://jade.talesoft.codes
MIT License
88 stars 10 forks source link

Variables handling goes wrong #25

Closed jacmoe closed 8 years ago

jacmoe commented 8 years ago

Houston, we have a problem :)

I have this markup:

!=$view->render('_search', ['model' => $searchModel])

Tale Jade gives me a Jade error:

Failed to parse jade: You should indent in by one level only

It actually does not matter what indentation I use.. Even if I don't indent at all. Buffered / unbuffered - it does not matter.

When I do this:

$view->render('_search', ['model' => $searchModel])

I get this output:

<?php >render('_search', ['model' => $searchModel])?>

Somehow Tale Jade is now doing some uspeakable things to my view variable :x

jacmoe commented 8 years ago

D'oh - the error was in between my ears :dancers:

Closing :octopus:

TorbenKoehn commented 8 years ago

Hello!

I just created a test for it (https://github.com/Talesoft/tale-jade/blob/dev-master/Test/ExpressionAndCodeTest.php#L63) The test passes for me, it compiles correctly.

Can you send me a greater part of the file you're parsing around the part where the error occurs? I think it's an indentation problem of any kind.

TorbenKoehn commented 8 years ago

Lol, tell me what happened haha

jacmoe commented 8 years ago

Torben, I totally forgot to check _search.jade :D Sorry about that. There was indeed indentation issues.

[edit] And that fixed it [/edit]

TorbenKoehn commented 8 years ago

Yeah, but that's important!

Obviously it seems to be hard to find errors in files you've rendered yourself inside another template, I will think about adding the file-name (if available) to the error messages :)

jacmoe commented 8 years ago

Yes it is challenging to debug. I like that there is compiled php code to look at most of the time. It could be better.