如何在enlive中进行身份转换?
How to make identity transformation in enlive?
我需要根据某些条件替换元素的内容。如果不满足条件,则元素应保持不变。
(enlive/deftemplate template (io/resource "templ.html")
[]
[:#el_id] (if (condition)
(enlive/content ...)
;; otherwise identity transformation here
))
我尝试使用 nil
作为身份转换,但它只是删除了元素。
identity
函数完成这项工作。抱歉打扰了。
我需要根据某些条件替换元素的内容。如果不满足条件,则元素应保持不变。
(enlive/deftemplate template (io/resource "templ.html")
[]
[:#el_id] (if (condition)
(enlive/content ...)
;; otherwise identity transformation here
))
我尝试使用 nil
作为身份转换,但它只是删除了元素。
identity
函数完成这项工作。抱歉打扰了。