Keats / tera

A template engine for Rust based on Jinja2/Django
http://keats.github.io/tera/
MIT License
3.48k stars 281 forks source link

Tera::render_str: 'autoescape' option missing #559

Open d4h0 opened 4 years ago

d4h0 commented 4 years ago

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.

Keats commented 4 years ago

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

d4h0 commented 4 years ago

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 commented 4 years ago

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 :)