yogthos/Selmer

Passing template variables to custom tags/filters?

Open

#78 建立於 2015年4月8日

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

描述

Hello, Is this possible?

E.g.

(selmer/add-tag! :getter
                 (fn [args context-map]
                   (let [field (first args)]
                     (str (if (= (:javaType field) "boolean") "is" "get") (:name field)))))

... or using a filter instead of the tag. And in the template:

{% for field in model.fields %}
    {% getter field %}
{% endfor %}

貢獻者指南

Passing template variables to custom tags/filters? · yogthos/Selmer#78 | Good First Issue