From faf15586fcc166d0855150680f05078b238cc0c1 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 7 Feb 2021 15:29:42 -0400 Subject: link to album commentary in multiline text --- upd8.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/upd8.js b/upd8.js index e53da22..1522d56 100755 --- a/upd8.js +++ b/upd8.js @@ -289,7 +289,7 @@ function getMultilineField(lines, name) { }; function transformInline(text) { - return text.replace(/\[\[(album:|artist:|flash:|track:|tag:|group:)?(.+?)\]\]/g, (match, category, ref, offset) => { + return text.replace(/\[\[(album:|album-commentary:|artist:|flash:|track:|tag:|group:)?(.+?)\]\]/g, (match, category, ref, offset) => { if (category === 'album:') { const album = getLinkedAlbum(ref); if (album) { @@ -300,6 +300,16 @@ function transformInline(text) { console.warn(`\x1b[33mThe linked album ${match} does not exist!\x1b[0m`); return ref; } + } else if (category === 'album-commentary:') { + const album = getLinkedAlbum(ref); + if (filterAlbumsByCommentary().includes(album)) { + return fixWS` + ${album.name} (commentary) + `; + } else { + console.warn(`\x1b[33mThe linked album ${match} does not exist or has no commentary!\x1b[0m`); + return ref; + } } else if (category === 'artist:') { const artist = getLinkedArtist(ref); if (artist) { -- cgit 1.3.0-6-gf8a5