【问题标题】:How to make identity transformation in enlive?如何在enlive中进行身份转换?
【发布时间】:2016-03-15 16:54:56
【问题描述】:

我需要根据某些条件替换元素的内容。如果条件不满足,则元素应保持不变。

(enlive/deftemplate template (io/resource "templ.html")
  []
  [:#el_id] (if (condition)
              (enlive/content ...)
              ;; otherwise identity transformation here
              ))

我尝试使用nil 作为身份转换,但它只是删除了元素。

【问题讨论】:

    标签: clojure enlive


    【解决方案1】:

    identity 函数完成了这项工作。很抱歉打扰你了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-25
      • 1970-01-01
      • 2021-05-07
      • 1970-01-01
      • 2012-12-30
      • 2012-04-15
      • 1970-01-01
      • 2016-11-11
      相关资源
      最近更新 更多