-
-
Notifications
You must be signed in to change notification settings - Fork 615
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
Map filter doesn't work as documented by Twig #623
Comments
Okay, that's definitely what's happening. I deleted the It's easy enough to get the Pico behavior using the Twig filter with something like |
This is exactly the reason, Twig added this filter after we did. I'll remove it from Pico 3.0, since we're breaking BC anyway and it can be replaced by Twig's Just for the record: Twig 2 also introduced the |
This should probably also be noted in picocms/picocms.github.io#54, as well as changed in the docs. 🤔 Just mentioning here that way it gets linked to over there. 😉 |
According to the Twig documentation, this example should display "Bob Smith, Alice Dupond":
However, it throws the following error:
The second example doesn't throw an error:
However, instead of displaying "Bob Smith, Alice Dupond" it displays "Smith, Dupond".
What I'd really like to do is map a list of tags to lowercase, e.g.:
I've tried several variations, including:
{{ tags | map(t => t | lower) | join(', ') }}
{{ tags | map(t => t | lower()) | join(', ') }}
{{ tags | map(t => t.lower) | join(', ') }}
{{ tags | map(t => t.lower()) | join(', ') }}
{{ tags | map(t => t | lower(t)) | join(', ') }}
{{ tags | map(t => t.strtolower) | join(', ') }}
{{ tags | map(t => t.strtolower()) | join(', ') }}
None of these work -- the output is always "Foo, Bar, Blah" -- yet none throw an error. It seems that anything I pass to the
map
filter it simply ignored. I wonder if the filter is being replaced by Pico's ownmap
filter, which works as described here:Any ideas?
The text was updated successfully, but these errors were encountered: