Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters are unable to access to other functions/tests #446

Open
tones111 opened this issue Sep 1, 2019 · 1 comment
Open

Filters are unable to access to other functions/tests #446

tones111 opened this issue Sep 1, 2019 · 1 comment

Comments

@tones111
Copy link
Contributor

tones111 commented Sep 1, 2019

This came up during the implementation of the map filter (#441) and I wanted to create an issue to allow for some discussion before the API gets locked down for v1.0.

There are some jinja capabilities that don't appear to be possible to implement with the current filter/test API. For example, map has a mode where each item of an array can be run through a function. Some other examples include reject/rejectattr/select/selectattr where a test predicate is supplied.

The initial solution provided a reference to the Tera instance to the filter API. Could you elaborate on why that solution can't work, or any alternate designs that could allow for these implementations? Thanks.

@Keats
Copy link
Owner

Keats commented Sep 3, 2019

Filters are traits so you can have whatever context you want, including a Tera instance. I think it's better for now to not support those filters as built-in and if someone want them, it's easy to implement in their own projects. Maybe my use cases are simpler for template engines but I have never used any of those :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants