djc / askama

Type-safe, compiled Jinja-like templates for Rust
Apache License 2.0
3.46k stars 218 forks source link

template attribute documentation #783

Open freelon opened 1 year ago

freelon commented 1 year ago

Hi,

I stumbled upon the template() attribute doc, which states

ext (as ext = "txt"): lets you specify the content type as a file extension [...]. Cannot be used together with path.

I found this not to be true, I could combine both (for example #[template(path = "welcome.html.j2", ext = "html")]) and it compiled and used the html extension and mime type (which I'm happy about, because this way I can at least somewhat specify the MIME type :) ). So I guess the docs should get fixed here.

livingsilver94 commented 1 year ago

That's not the case. In fact, j2 is a supported extension. Try to replace ".j2" with, say, ".in" and you'll find out that ext = "html" is ignored.