8 Feb
2023
8 Feb
'23
4:12 p.m.
Dominique Devienne wrote:
There are 4 use-cases IMHO, for a templating engine: 1) pure text-template. No escaping; 2) text-template to embed in some custom format, with its own escaping rules; 3) template generates HTML, and "some" characters of the placeholders need escaping; 4) template generates text, possibly HTML-like, meant to be embedded into HTML, thus "more" escaping is necessary.
I actually encountered (2) when writing the examples, because to generate proper markdown, apostrophes must be escaped. So there's definitely a practical need to supply a custom escaping function.