You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.
In general each templating library has a different method for integrating custom filters / external functions / whatever. Where possible, we should just supply implementations for those in this library, instead of modifying external libraries. e.g. in tera there's various register_xyz implementations; we could provide one of those in this crate, behind a feature flag.
In askama's case though, I think we need to at least add some sort of support for passing kwargs to templates; currently they only take ordered arguments. It might also be possible to just pass all the members of an askama template struct through to fluent. There's a design space there, explore it at your leisure.
The code in my old PR could give you a hint at where to start. https://github.com/djc/askama/pull/211; it's a little messy and bitrotted, but I added a parser for localize expressions to askama_derive/src/parser.rs, support for embedding a Localize impl in an askama template in askama_derive/src/input.rs, and support for generating calls to that impl in askama_derive/src/generator.rs. The rest of the code in that PR is in this crate.
Keep in mind this project isn't officially "released" yet and i'm going to do a little more iteration on the core design this week (like changing Localize::localize to take an &mut io::Write instead of returning a String).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
http://www.arewewebyet.org/topics/templating/
The text was updated successfully, but these errors were encountered: