使用板材,多年来不断变化的sintax(这已经不起作用了)和糟糕的文档,
我有这个字符串:
<table id="group">
<tr>
<td class="name"></td>
<td>
<a class="surname"></a>
</td>
</tr>
</table>
这个数据:
{
group: [{
name: 'Ludwig',
surname: 'von Mises',
url: 'http://mises.org/'
}, {
name: 'Friedrich',
surname: 'Hayek',
url: 'http://hayek.org/'
}],
}
我应该怎么做才能将url
绑定到href
,从而获得
<table id="group">
<tr>
<td class="name">Ludwig</td>
<td>
<a class="surname" href="http://mises.org/">Mises</a>
</td>
</tr>
<tr>
<td class="name">Friedrich</td>
<td>
<a class="surname" href="http://hayek.org/">Hayek</a>
</td>
</tr>
</table>
面对其他库的一个简单问题,我做了任何程序员在这种情况下都会做的事情:我编写了自己的类似Plates(但不是它的分支)的模板引擎,它(可能)可以工作。
它在这里:https://github.com/fiatjaf/tempreites
(适用于字符串、语义绑定、只有一个文件、没有依赖项、一个名为render
的简单同步函数,就这样。)
(我在这里发布这个问题后就开始写了,所以这不仅仅是为了宣传。)