-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when including a template that extends another #385
Comments
Ah perfect, I guess that's a reproduction of #370 Not sure what the behaviour should be though, probably an error message instead of a panic |
The main issue with allowing In practice |
Isn't it better to explicitly detect infinite loops? How can macros be used in this case? |
In our project we need potentially complex documents in other bigger, also complex documents, I don't know macros very well but I don't know if they are powerful enough to cover that use case. |
With a configurable recursion depth limit in Tera and app-level prevention of insane template structures, I think we'd handle the complexity well from both ends. |
I never use Do you have an example of complex include? Macros are like functions returning text so you can do everything allowed in Tera aside from inheritance |
the software as a whole is fairly complex. would you run it if installation was simple and easy enough to quickly try this out? |
Is it not possible to get a sample included file? |
I'm pretty sure this is our use case that causes the bug: https://github.com/lighttouch-themes/subscription-menu/blob/master/layouts/base-example.html but we use |
That indeed uses |
It doesn't uses inheritance in includes yet precisely because it's broken, hence the issue |
I am personally not planning to implement that feature, is one of you interested in doing it? |
yes, Arnaud said he will code it if you have any tips ahead, that's cool |
I think that's not going to be trivial as allowing extends means you have to render the include as actual template with the current context (eg an include in a loop). |
Is there anything wrong with this approach? It was doing something with the call stack and pushing an include frame that I removed, is that important? I think the included template then doesn't have access to locals declared in the including template, when previously it had, is that right? It's still missing the recursion check, but I want to know if it's going the right way. No tests are failing with these changes (Except all the error cases, wtf) |
Test project showcasing the error: https://github.com/Arnaz87/tera-test
And the traceback:
The text was updated successfully, but these errors were encountered: