我在 enlive 中创建了一个模板,并且在使用这个产生lazyseq 的片段时遇到了问题。当我在 REPL 中尝试这个 sniptest 时,它会产生“clojure.lang.LazySeq@ba6da9f2”。
(h/sniptest (template-div)
[:div.Row] (h/content (map #(value-cell %)
(for [e(:data-content msh-contents)]
(vals e)))))
测试它所需的其余代码如下所示
(require '[net.cgrand.enlive-html :as h])
(def msh-contents {:title "Events mashup",
:data-content [{:title "ICTM Study Group ",
:url "http://some-url.com"}
{:title "Volodja Balzalorsky - Hinko Haas",
:url "http://some- other-url.com"}
]})
(defn template-div[] (h/html-resource "index.html"))
(h/defsnippet value-cell (template-div)
[:div.Row :div.Cell] [value]
(h/content value))
index.html 文件看起来像这样(也可以在这里找到http://www.filedropper.com/index_25))
<div class="Table">
<div class="Title">
<p>This is a Table</p>
</div>
<div class="Heading">
<div class="Cell">
<p>Heading 1</p>
</div>
</div>
<div class="Row">
<div class="Cell">
<p>Row 1 Column 1</p>
</div>
</div>
我看到了一个类似的问题,但解决方案是使用内容而不是 html-content。不知道是什么导致了这里的问题......