我使用这个 Enlive 模板将它下面的 HTML 转换为下面的 HTML。基于一组 twitter 名称,我生成了一个带有链接的表。我怎样才能摆脱里面的打嗝enlive/clone-for
?
(enlive/deftemplate usernames-table-body
"public/whoisnotfollowingme.html"
[usernames]
[:table.names :tbody :tr]
(enlive/clone-for [username usernames]
[:td]
(enlive/html-content
(html [:a {:href (str "https://twitter.com/intent/user?screen_name=" username)} username]))))
HTML 输入
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/bootstrap/css/bootstrap.css"/>
</head>
<body>
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<div class="container">
<div class="hero-unit">
<p class="names">These people who you are following are not following you back!</p>
</div>
<table class="names table table-striped">
<thead>
<tr>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
HTML 输出
<html>
<head>
<link href="/bootstrap/css/bootstrap.css" rel="stylesheet" />
</head>
<body>
<script src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<div class="container">
<div class="hero-unit">
<p class="names">These people who you are following are not following you back!</p>
</div>
<table class="names table table-striped">
<thead>
<tr>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td> < a href =" https://twitter.com/intent/user?screen_name=foo " > foo </ a > </td>
</tr> <tr>
<td> < a href =" https://twitter.com/intent/user?screen_name=bar " > bar </ a > </td>
</tr>
</tbody>
</table>
</div>
</body>
</html>