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 %}

贡献者指南