From 5e3042d2e37e835bffef477b4003aa323e1e66d8 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 2 Jul 2022 13:53:26 -0300 Subject: clean up track html code --- src/page/track.js | 70 ++++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 39 deletions(-) (limited to 'src/page') diff --git a/src/page/track.js b/src/page/track.js index 021342ec..edc8c200 100644 --- a/src/page/track.js +++ b/src/page/track.js @@ -51,43 +51,35 @@ export function write(track, {wikiData}) { } const unbound_getTrackItem = (track, {getArtistString, link, language}) => - html.tag( - 'li', + html.tag('li', language.$('trackList.item.withArtists', { track: link.track(track), - by: `${language.$('trackList.item.withArtists.by', { - artists: getArtistString(track.artistContribs), - })}`, - }) - ); + by: html.tag('span', + {class: 'by'}, + language.$('trackList.item.withArtists.by', { + artists: getArtistString(track.artistContribs), + })), + })); const hasCommentary = track.commentary || otherReleases.some((t) => t.commentary); + const generateCommentary = ({link, language, transformMultiline}) => - transformMultiline( - [ - track.commentary, - ...otherReleases.map((track) => - track.commentary - ?.split('\n') - .filter((line) => line.replace(/<\/b>/g, '').includes(':')) - .map( - (line) => fixWS` - ${line} - ${language.$( - 'releaseInfo.artistCommentary.seeOriginalRelease', - { - original: link.track(track), - } - )} - ` - ) - .join('\n') - ), - ] - .filter(Boolean) - .join('\n') - ); + transformMultiline([ + track.commentary, + ...otherReleases.map((track) => + track.commentary + ?.split('\n') + .filter((line) => line.replace(/<\/b>/g, '').includes(':')) + .flatMap(line => [ + line, + language.$('releaseInfo.artistCommentary.seeOriginalRelease', { + original: link.track(track), + }), + ]) + .join('\n') + ), + ].filter(Boolean).join('\n')); const data = { type: 'data', @@ -206,14 +198,14 @@ export function write(track, {wikiData}) { // disabled for now! shifting banner position per height of page is disorienting /* - banner: album.bannerArtistContribs.length && { - classes: ['dim'], - dimensions: album.bannerDimensions, - path: ['media.albumBanner', album.directory, album.bannerFileExtension], - alt: language.$('misc.alt.albumBanner'), - position: 'bottom' - }, - */ + banner: album.bannerArtistContribs.length && { + classes: ['dim'], + dimensions: album.bannerDimensions, + path: ['media.albumBanner', album.directory, album.bannerFileExtension], + alt: language.$('misc.alt.albumBanner'), + position: 'bottom' + }, + */ main: { content: [ -- cgit 1.3.0-6-gf8a5