askama
askama copied to clipboard
Allow using arbitrary delimiters
- Allow delimiters with arbitrary length
- Allow setting expr_start, etc. in Rust source
Actually, using a single character as delimiter (even such a character as newline) (w|sh)ould work, but then it would be difficult to extend the language in the future if we have to assume that any and all characters are used in the wild.
What are you trying to achieve here? Conceptually I don't really like the idea of giving Config
access to the TemplateArgs
.
Well, 1st and foremost I wanted to remove the restriction that you have to use exactly two ASCII characters as delimiters. With this PR you can use any and all unicode characters. And then I find setting up a config file cumbersome. Right now you can already set the whitespace handling in the code where you derive the template, without needing to resort to using a config file. So I added the option to set the other parts of the configuration, too. I pass &TemplateArgs instead of adding six new parameters, because until Rust adds named parameters having so many parameters is quite error prone, esp. when every parameter has the same type.
In the end I want to use askama to format a single latex file. Using braces as delimiters does not work very well in this context. Adding a config file would make the code less readable, IMO, because I have no code duplication anyway.
Sorry for the slow feedback.
No problem at all!
What do you think about adding a new syntax config struct {whitespace, block_start, ..}
that I would pass around? Instead of template_whitespace
in the current version, or the whole TemplateArgs
I in my PR proposed?
What do you think about adding a new syntax config struct
{whitespace, block_start, ..}
that I would pass around? Instead oftemplate_whitespace
in the current version, or the wholeTemplateArgs
I in my PR proposed?
Sounds like a decent path forward? I'd have to see it in more detail to be sure, though.
PR needs to be redone entirely, because the codebase changed entirely.