Open mckingho opened 3 years ago
All of the filters are exposed and can be added to the parser like the default set does: https://github.com/cobalt-org/liquid-rust/blob/master/src/parser.rs#L109
You'll have to use a newtype to give it a new name.
Whats the motivation for renaming?
url_param_escape
is a filter supported in shopify. It is very similar to url_encode
. Before I posted this question, I want to find a way to do some alias mapping rather than duplicate all the codes from url_encode
. Because I want to support both filters, not renaming.
But I just review shopify's document, there is slight difference between two filters. So I am going to write a custom one instead.
Either way, if you are up for contributing it back, that'd be great! We are working on having the official liquid filters, shopify, jekyll, and custom, see https://github.com/cobalt-org/liquid-rust/tree/master/crates/lib/src
liquid-rust version: 0.21.4 rust version: 1.49.0 OS: Any
I want to add a custom filter called
url_param_escape
, which is exactly the same function of a standard filterurl_encode
in the module. Can I bind new filter name to existing filter so that both filter name are valid and function the same way?Edit: This is my solution.
originalFilter
is the struct of original filter thatimpl Filter
trait.