Keats / tera

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

Add pad filter #921

Open uncenter opened 1 month ago

uncenter commented 1 month ago

Adds a new filter called pad which pads a given string to a given length with a given fill character (defaults to a space).

uncenter commented 1 month ago

Ah, just saw https://github.com/Keats/tera/pull/900#issuecomment-1938673386. Is it worth opening a PR over at https://github.com/Keats/tera2 instead or is that premature?

Keats commented 1 month ago

Filters are not implemented yet in tera2 but I would wait. I did work a bit on it yesterday and i'm seeing the light regarding that. A dim light still but it's getting there.

uncenter commented 1 month ago

Glad to hear it! Excited for tera2. Would you be interested in adding this sort of filter when the time comes for tera2 though? I also have some thoughts about some filters that should be potentially removed/deprecated in the next breaking version...

Keats commented 1 month ago

Some will be yes, i'll create a separate crate for non-basic filters/functions so i can do breaking change in that without issues. This one should be able to be added in the crate itself