const lengths = {
0: 'short',
2000: 'medium',
10000: 'long'
};
dv.pages('"logs/journal"').groupBy(p => p.file.cday.year).sort(p => p.key, 'desc').forEach(yearGroup => {
dv.header(1, yearGroup.key);
dv.table(["Entry", "Length"],
yearGroup.rows
.sort(p => p.file.name, 'desc')
.where(p => !p['exclude-from-list'])
.map(p => {
const entryLengthKey = Object.keys(lengths).reverse().find(length => {
length = parseInt(length, 10);
return p.file.size > length;
});
const entryLength = lengths[entryLengthKey];
return [
p.file.link,
entryLength
];
}));
});