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

String keys in for loops #133

Open
ism-ssw opened this issue Oct 5, 2016 · 1 comment
Open

String keys in for loops #133

ism-ssw opened this issue Oct 5, 2016 · 1 comment

Comments

@ism-ssw
Copy link

ism-ssw commented Oct 5, 2016

Related to #54 I am trying to do something similar with a for loop.

As an example if the for variable is a keyword this works

(render "{% for a in Amt %}{{a.attr.Ccy}}{{a.content.0}} {% endfor %}" 
    {:Amt [{:attr {"Ccy" "USD"}, :content ["0.010000000"]} 
           {:attr {"Ccy" "GBP"}, :content ["0.020000000"]}]})
 => "USD0.010000000 GBP0.020000000 "

However changing :Amt to "Amt" produces nothing

 (render "{% for a in Amt %}{{a.attr.Ccy}}{{a.content.0}} {% endfor %}" 
    {"Amt" [{:attr {"Ccy" "USD"}, :content ["0.010000000"]} 
            {:attr {"Ccy" "GBP"}, :content ["0.020000000"]}]})
=> ""

Should this be added as an enhancement to make processing consistent?

@yogthos
Copy link
Owner

yogthos commented Oct 5, 2016

I think that's reasonable. Since it already behaves this way in one place, it makes sense to have the same behavior in others. Would you be up for doing a pr for this one?

lucacervello added a commit to lucacervello/Selmer that referenced this issue Mar 23, 2017
yogthos pushed a commit that referenced this issue Mar 24, 2017
* fix issue #133

* improved performance and reuse an older function

* Added some tests
lucacervello added a commit to lucacervello/Selmer that referenced this issue Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants