If statement 有条件地显示内容或不显示在deftemplate宏中(Clojure-Enlive)

If statement 有条件地显示内容或不显示在deftemplate宏中(Clojure-Enlive),if-statement,clojure,macros,enlive,If Statement,Clojure,Macros,Enlive,到目前为止,我已经设法找到了如何使用clone for复制div,但在deftemplate宏中还没有找到有条件地应用转换的函数 (deftemplate threads "thread.html" [xs] [:div.entry] ;hook to a div (clone-for [x xs] ;for each in the array passed in (if (contains? x :picture) ;if picture in object

到目前为止,我已经设法找到了如何使用clone for复制div,但在deftemplate宏中还没有找到有条件地应用转换的函数

(deftemplate threads "thread.html" [xs]
  [:div.entry] ;hook to a div
  (clone-for [x xs] ;for each in the array passed in
      (if (contains? x :picture) ;if picture in object
        ([:div.entry :> :img] (set-attr :src (:picture x))) ;show picture
        ([:div.entry] (set-attr :style "display:none;"))) ;else hide element
      ;do more things here
      ))

(threads [{:picture 'link goes here'},{},...])
返回

java.lang.IllegalArgumentException: Key must be integer
我想知道是否有比enlive更有经验的人可以帮忙?我不确定下面应该写什么

  (if (contains? x :picture) ;if picture in object
        ([:div.entry :> :img] (set-attr :src (:picture x))) ;show picture
        ([:div.entry] (set-attr :style "display:none;"))) ;else hide element

编辑:根据Alan的建议,我已经注释并删除了与下面问题无关的代码。

您能添加示例输入和所需输出吗?同时删除不需要的项目,如
time
uid
,等等。我已经清理了一些。