tera icon indicating copy to clipboard operation
tera copied to clipboard

Tera::render_str: 'autoescape' option missing

Open d4h0 opened this issue 5 years ago • 3 comments

Hi,

Tera::one_off has an 'autoescape' option (that makes it possible to define if HTML escaping is on or off). Tera::render_str – which seems to be the same method but for an existing Tera instance – is missing this option for some reason.

d4h0 avatar Sep 15 '20 16:09 d4h0

Damn that's a silly omission. Changing it is a breaking change though :(

Keats avatar Sep 15 '20 17:09 Keats

Maybe a second method can be added, with a warning that it will be deprecated or removed after the next major release?

At least the current behavior of Tera::render_str should be documented (does it escape, or not? I guess the default setting of the Tera instance will be used).

(This is offtopic, but it also would be useful if the docs would say if or if not the Tera::render_str one-off template has access to all of the functionality that regular templates in the Tera instance have. Most likely they have, but this wasn't clear to me at a glance).

d4h0 avatar Sep 15 '20 17:09 d4h0

On the other hand, one-off templates don't have a file extension, so the default value can't even be used (if I understand everything correctly). Even more important to document the behavior of Tera::render_str :)

d4h0 avatar Sep 15 '20 18:09 d4h0