yogthos/Selmer

Passing template variables to custom tags/filters?

Open

#78 opened on Apr 8, 2015

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Clojure (670 stars) (86 forks)batch import
enhancementhelp wanted

Description

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

Contributor guide