From 589273c5e1d63e5f68ecedd68c9d4b49c36b25f4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 12 May 2022 21:55:03 -0300 Subject: additional files These are basically supported for tracks but I've only implemented them for albums for the moment (read: I'm lazy!). --- src/page/album.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/page') diff --git a/src/page/album.js b/src/page/album.js index 5ea7c5a0..8df8a678 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -53,7 +53,8 @@ export function write(album, {wikiData}) { }`; }; - const commentaryEntries = [album, ...album.tracks].filter(x => x.commentary).length; + const hasCommentaryEntries = ([album, ...album.tracks].filter(x => x.commentary).length > 0); + const hasAdditionalFiles = (album.additionalFiles?.length > 0); const albumDuration = getTotalDuration(album.tracks); const listTag = getAlbumListTag(album); @@ -100,6 +101,8 @@ export function write(album, {wikiData}) { path: ['album', album.directory], page: ({ fancifyURL, + generateAdditionalFilesShortcut, + generateAdditionalFilesList, generateChronologyLinks, generateCoverLink, getAlbumCover, @@ -181,12 +184,15 @@ export function write(album, {wikiData}) { }) ].filter(Boolean).join('
\n')}

- ${commentaryEntries && `

${ - language.$('releaseInfo.viewCommentary', { - link: link.albumCommentary(album, { - text: language.$('releaseInfo.viewCommentary.link') + ${(hasAdditionalFiles || hasCommentaryEntries) && fixWS`

+ ${[ + hasAdditionalFiles && generateAdditionalFilesShortcut(album.additionalFiles, {language}), + hasCommentaryEntries && language.$('releaseInfo.viewCommentary', { + link: link.albumCommentary(album, { + text: language.$('releaseInfo.viewCommentary.link') + }) }) - }) + ].filter(Boolean).join('
\n') }

`} ${album.urls?.length && `

${ language.$('releaseInfo.listenOn', { @@ -212,6 +218,9 @@ export function write(album, {wikiData}) { ${album.tracks.map(trackToListItem).join('\n')} `} + ${hasAdditionalFiles && generateAdditionalFilesList(album.additionalFiles, { + linkFile: file => link.albumAdditionalFile({album, file}) + })} ${album.dateAddedToWiki && fixWS`

${[ -- cgit 1.3.0-6-gf8a5