You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not currently. I was thinking of adding a render_macro for v2 (Keats/tera2#27) but do people prefer blocks?
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 imported in order to run. Being able to group them into a single file and then render one of them will solve a lot of problems.
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: