diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-02-07 15:29:42 -0400 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-02-07 15:30:06 -0400 |
commit | faf15586fcc166d0855150680f05078b238cc0c1 (patch) | |
tree | ae03fd98a082dc59c9b90e5b15c7aae08268b17f | |
parent | 3e06706faee9d509e9d377f39634af1c21de198e (diff) |
link to album commentary in multiline text
-rwxr-xr-x | upd8.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/upd8.js b/upd8.js index e53da22f..1522d56f 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` + <a href="${C.COMMENTARY_DIRECTORY}/${C.ALBUM_DIRECTORY}/${album.directory}/" style="${getLinkThemeString(album)}">${album.name} (commentary)</a> + `; + } 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) { |