Hey guys, thought I’d share this little bit with you.
I organize my tags with emojis everywhere. I like the visuals.
So for every input I have (books I read, blog posts, podcasts, etc.) I have an emoji for the input and then for the status (green: read, yellow: in process, red: to read)
So in the end, it looks like that:
/
/
(for an article in the reading list, unread yet)
/
/
( for a podcast I processed)
Now, I wanted to create a view of “reading list” to show me all the items that are red.
It turned out to be more difficult than expected - as emojis are very problematic with dataview.
The only solution I found, was to turn the emoji text to unicode representation string and then check if I have the expected part.
For any future tinkerer, this is my solution:
function toUnicode(str) {
return str.split('').map(function (value, index, array) {
var temp = value.charCodeAt(0).toString(16).toUpperCase();
if (temp.length > 2) {
return '\\u' + temp;
}
return value;
}).join('');
}
let pages = dv.pages('-"_Templates"')
let unprocessed = []
for (let page of pages) {
if (!page.file.etags[0]) { continue; }
if (page.type !== "article") { continue; }
let unicode_tags_string = toUnicode(page.file.etags[0]);
if(unicode_tags_string.includes("DD34")) {
unprocessed.push(page)
}
}
unprocessed = dv.array(unprocessed)
dv.table(["File", "Tagsssss"], unprocessed.map(k => [k.file.link, k.tags]))