Open txtyash opened 9 months ago
Not currently. I was thinking of adding a render_macro for v2 (https://github.com/Keats/tera2/issues/27) but do people prefer blocks?
Not currently. I was thinking of adding a render_macro for v2 (https://github.com/Keats/tera2/issues/27) but do people prefer blocks?
The problem I am dealing with is file redundancy for little divs.
Not currently. I was thinking of adding a render_macro for v2 (https://github.com/Keats/tera2/issues/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 import
ed 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.