djc / askama

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

Add `title` filters #1039

Closed GuillaumeGomez closed 2 months ago

GuillaumeGomez commented 2 months ago

Part of https://github.com/djc/askama/issues/18.

I also used this opportunity to update the list in the first message of the issue.

GuillaumeGomez commented 2 months ago

Applied suggestions and also added the string filter.

djc commented 2 months ago

What's the point of the string filter if simply using an expression already relies on Display?

GuillaumeGomez commented 2 months ago

In case you want to do operation on the generated string?

djc commented 2 months ago

Do you have an actual use case for that?

GuillaumeGomez commented 2 months ago

Not personally. My potential use case would be to format a struct that was turned into a string. But I could write my own filter for that. I can remove the second commit of the PR if you're not convinced. ;)

djc commented 2 months ago

Not personally. My potential use case would be to format a struct that was turned into a string. But I could write my own filter for that. I can remove the second commit of the PR if you're not convinced. ;)

Yeah, let's wait until someone comes up with a use case.

GuillaumeGomez commented 2 months ago

Removed it!

GuillaumeGomez commented 2 months ago

Updated the book and replaced the fold iterator with a for loop.