yogthos/Selmer

String keys in for loops

Open

#133 建立於 2016年10月5日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Clojure (670 star) (86 fork)batch import
enhancementhelp wanted

描述

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?

貢獻者指南