-
Notifications
You must be signed in to change notification settings - Fork 93
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
Handling of maps in for-loops #125
Comments
@hartfelt thanks for your detailed report. I will get back to you this weekend. |
@bkiers Thanks for the quick reply. I'll look forward to your further comments :) |
Thanks, your solution was spot on. I only needed to unwrap the stream/collect calls since it (still) needs to be Java 7 compliant. |
Great! Thanks for the quick resolution 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
According to https://github.com/shopify/liquid/wiki/Liquid-for-Designers it should be possible to iterate a map with a forloop, like:
I don't see any mention of this on https://shopify.github.io/liquid/tags/iteration/ though, but a quick test show that it is indeed supported by the ruby version:
However, the current handling in liqp is to wrap the entire map in a list, resulting in one iteration where
item
is equals tohash
. This behaviour is a result ofasArray(Object value) -> Object[]
inLValue
, and is indeed documented in the comment there. Is this difference from the ruby version intentional or just an oversight?As an experiment, in the codebase where I'm using liqp, I've copied the for-tag in order to add the following (quite hackish) case to asArray:
...which makes the following test pass:
If the current behaviour is indeed an oversight, I'll work on cleaning up the above fix and submit it as a merge request, along with some tests.
Or, if some other approach is preferred, feel free to point me in the right direction ;)
--
Bjørn Hartfelt
The text was updated successfully, but these errors were encountered: