Closed GuillaumeGomez closed 4 months ago
It seems like an anti-feature to me in the context of Askama/Rust -- we would not be able to support char
properly.
(Also not sure why double quotes wouldn't work in the example you gave.)
Fair point. What about emitting an error if it's not a char then to prevent having to debug with generated code instead?
Also, as I mentioned, it was only for syntax highlighting. In my IDEs (emacs and sublime text), if I use double quotes strings in double quotes string, they're both a bit lost. :)
Fair point. What about emitting an error if it's not a char then to prevent having to debug with generated code instead?
Does it currently error? How? I think making this properly a char
would be okay.
Also, as I mentioned, it was only for syntax highlighting. In my IDEs (emacs and sublime text), if I use double quotes strings in double quotes string, they're both a bit lost. :)
Hmm, sounds they're like confused about what syntax they're parsing?
Does it currently error? How? I think making this properly a
char
would be okay.
jinja considers 'string'
the same as "string"
: both are strings. In the case of askama, it takes 'string'
and doesn't make any changes to it, generating invalid rust code since 'string'
is not a valid char, which generates this error:
error: character literal may only contain one codepoint
We could detect this error in askama and I think we should. It would make user experience much better.
Hmm, sounds they're like confused about what syntax they're parsing?
Very likely. It's not a big issue, just something I thought could be improved. But having stricter types directly into the templates sounds better to me. We just need to improve how this error is handled in askama.
We could detect this error in askama and I think we should. It would make user experience much better.
Sounds good to me.
Gonna send a PR later on then. I'm reaching the end of the port to askama in docs.rs. It's exciting. :)
Good to hear!
jinja spec mentions that strings can be either single or double quotes. It is often useful for syntax highlighting when you have cases like:
Would you be open for me to implement it?