Skip to content
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

Streamable templates #953

Open
evroon opened this issue Dec 18, 2024 · 4 comments
Open

Streamable templates #953

evroon opened this issue Dec 18, 2024 · 4 comments

Comments

@evroon
Copy link

evroon commented Dec 18, 2024

I found this issue: #211 but it has been closed for the last 5 years without update.

So I wondered whether this is something that's still being considered. I think it makes a lot of sense to support streaming, both for better user experience in for example webserver responses, but most of all as it reduces RAM usage.

To be more precise: with streaming I mean that the renderer can take an iterator as input and loop over all items of the input to generate the template. The output of the renderer is then not a string, but something that implements the Write trait.

minijinja does support streaming for example, but I would prefer not to use minijinja for other reasons.

@Keats
Copy link
Owner

Keats commented Dec 18, 2024

@evroon
Copy link
Author

evroon commented Dec 18, 2024

Ah that solves the second part of my problem, but is there a way to pass variables of type iterator to the template's context? Like what happens here

@Keats
Copy link
Owner

Keats commented Dec 18, 2024

No, not currently. It could maybe be added to v2 (https://github.com/Keats/tera2) but that would be a significant amount of work that I wouldn't have time to do myself

@evroon
Copy link
Author

evroon commented Dec 18, 2024

Ah okay, understandable, thanks for letting me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants