diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-05-12 21:55:03 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-05-12 21:55:41 -0300 |
commit | 589273c5e1d63e5f68ecedd68c9d4b49c36b25f4 (patch) | |
tree | f63558c64813531496d5306a754b7773e6a2bd95 /src/page | |
parent | 9dbc0792c8988e97b1b93b83b27b1aa62dfc1875 (diff) |
additional files
These are basically supported for tracks but I've only implemented them for albums for the moment (read: I'm lazy!).
Diffstat (limited to 'src/page')
-rw-r--r-- | src/page/album.js | 21 |
1 files changed, 15 insertions, 6 deletions
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}) { }</li>`; }; - 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('<br>\n')} </p> - ${commentaryEntries && `<p>${ - language.$('releaseInfo.viewCommentary', { - link: link.albumCommentary(album, { - text: language.$('releaseInfo.viewCommentary.link') + ${(hasAdditionalFiles || hasCommentaryEntries) && fixWS`<p> + ${[ + hasAdditionalFiles && generateAdditionalFilesShortcut(album.additionalFiles, {language}), + hasCommentaryEntries && language.$('releaseInfo.viewCommentary', { + link: link.albumCommentary(album, { + text: language.$('releaseInfo.viewCommentary.link') + }) }) - }) + ].filter(Boolean).join('<br>\n') }</p>`} ${album.urls?.length && `<p>${ language.$('releaseInfo.listenOn', { @@ -212,6 +218,9 @@ export function write(album, {wikiData}) { ${album.tracks.map(trackToListItem).join('\n')} </${listTag}> `} + ${hasAdditionalFiles && generateAdditionalFilesList(album.additionalFiles, { + linkFile: file => link.albumAdditionalFile({album, file}) + })} ${album.dateAddedToWiki && fixWS` <p> ${[ |