1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-18 14:25:46 +01:00

Get rid of template.map overloading, add standard "usage" template for ex/vi/option

This commit is contained in:
Kris Maglione
2008-10-08 03:41:55 +00:00
parent 10376ecb77
commit 4ff5adcc4e
6 changed files with 26 additions and 41 deletions

View File

@@ -5,17 +5,11 @@ liberator.template = {
map: function (iter, fn, sep)
{
if (fn.length > 1)
{
iter = Iterator(iter);
let oldfn = fn;
fn = function (x) oldfn.apply(null, x);
}
else if (iter.length) /* Kludge? */
if (iter.length) /* Kludge? */
iter = liberator.util.arrayIter(iter);
let ret = <></>;
let n = 0;
for each (let i in iter)
for each (let i in Iterator(iter))
{
let val = fn(i);
if (val == undefined)
@@ -215,12 +209,26 @@ liberator.template = {
this.map(iter, function (row)
<tr>
{
liberator.template.map(row, function (i, d)
liberator.template.map(Iterator(row), function ([i, d])
<td style={style[i] || ""}>{d}</td>)
}
</tr>)
}
</table>);
},
usage: function (iter)
{
return this.generic(
<table>
{
this.map(iter, function (item)
<tr>
<td class="hl-Title" style="padding-right: 20px">{item.name || item.names[0]}</td>
<td>{item.description}</td>
</tr>)
}
</table>);
},
};