-
Notifications
You must be signed in to change notification settings - Fork 293
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
Is there a function similar to minijinja's render_block? #896
Comments
Not currently. I was thinking of adding a render_macro for v2 (Keats/tera2#27) but do people prefer blocks? |
The problem I am dealing with is file redundancy for little divs. |
Blocks or macros are both fine for me, just any way to render a subset of a full file. This will avoid having hundreds of small snippet files, which each of them must be individually Curiously, right now templates can do this by rendering a single macro out of a file of macros, but Rust has no way of doing the same short of rendering the entire file. This, to me, is an omission that should be fixed. As to the question of blocks vs macros, personally I find macros versatile, except for the large number of parameters. It would help heaps if Tera can specify a hash object that I can pass into a macro as one single parameter instead of having to flatten them all out. Some of my more complex macros have 20+ parameters! |
Minijinja has this render_block method https://docs.rs/minijinja/latest/minijinja/struct.State.html#method.render_block
Is there anything similar?
I was facing a problem where I wanted to render small divs for which I have to create separate files.
The text was updated successfully, but these errors were encountered: