From 1484f926086582fe28f4cbc6b05f8b8279404e84 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 28 Jun 2022 23:12:17 -0300 Subject: htmlify track pages... Exparimentally --- src/page/track.js | 297 +++++++++++++++++++++--------------------------------- 1 file changed, 116 insertions(+), 181 deletions(-) (limited to 'src/page') diff --git a/src/page/track.js b/src/page/track.js index 29a07431..021342ec 100644 --- a/src/page/track.js +++ b/src/page/track.js @@ -216,187 +216,122 @@ export function write(track, {wikiData}) { */ main: { - content: fixWS` - ${ - cover && - generateCoverLink({ - src: cover, - alt: language.$('misc.alt.trackCover'), - tags: track.artTags, - }) - } -

${language.$('trackPage.title', { - track: track.name, - })}

-

- ${[ - language.$('releaseInfo.by', { - artists: getArtistString(track.artistContribs, { - showContrib: true, - showIcons: true, - }), - }), - track.coverArtistContribs.length && - language.$('releaseInfo.coverArtBy', { - artists: getArtistString( - track.coverArtistContribs, - { - showContrib: true, - showIcons: true, - } - ), - }), - track.date && - language.$('releaseInfo.released', { - date: language.formatDate(track.date), - }), - track.coverArtDate && - +track.coverArtDate !== +track.date && - language.$('releaseInfo.artReleased', { - date: language.formatDate(track.coverArtDate), - }), - track.duration && - language.$('releaseInfo.duration', { - duration: language.formatDuration( - track.duration - ), - }), - ] - .filter(Boolean) - .join('
\n')} -

-

${ - track.urls?.length - ? language.$('releaseInfo.listenOn', { - links: language.formatDisjunctionList( - track.urls.map((url) => - fancifyURL(url, {language}) - ) - ), - }) - : language.$('releaseInfo.listenOn.noLinks') - }

- ${ - otherReleases.length && - fixWS` -

${language.$('releaseInfo.alsoReleasedAs')}

- - ` - } - ${ - track.contributorContribs.length && - fixWS` -

${language.$('releaseInfo.contributors')}

- - ` - } - ${ - referencedTracks.length && - fixWS` -

${language.$('releaseInfo.tracksReferenced', { - track: `${track.name}`, - })}

- ${html.tag( - 'ul', - referencedTracks.map(getTrackItem) - )} - ` - } - ${ - referencedByTracks.length && - fixWS` -

${language.$('releaseInfo.tracksThatReference', { - track: `${track.name}`, - })}

- ${generateTrackListDividedByGroups( - referencedByTracks, - { - getTrackItem, - wikiData, - } - )} - ` - } - ${ - wikiInfo.enableFlashesAndGames && - flashesThatFeature.length && - fixWS` -

${language.$('releaseInfo.flashesThatFeature', { - track: `${track.name}`, - })}

- - ` - } - ${ - track.lyrics && - fixWS` -

${language.$('releaseInfo.lyrics')}

-
- ${transformLyrics(track.lyrics)} -
- ` - } - ${ - hasCommentary && - fixWS` -

${language.$('releaseInfo.artistCommentary')}

-
- ${generateCommentary({ - link, - language, - transformMultiline, - })} -
- ` - } - `, + content: [ + cover && generateCoverLink({ + src: cover, + alt: language.$('misc.alt.trackCover'), + tags: track.artTags, + }), + + html.tag('h1', language.$('trackPage.title', {track: track.name})), + + html.tag('p', [ + language.$('releaseInfo.by', { + artists: getArtistString(track.artistContribs, { + showContrib: true, + showIcons: true, + }), + }), + track.coverArtistContribs.length && language.$('releaseInfo.coverArtBy', { + artists: getArtistString( + track.coverArtistContribs, + { + showContrib: true, + showIcons: true, + } + ), + }), + track.date && language.$('releaseInfo.released', { + date: language.formatDate(track.date), + }), + track.coverArtDate && +track.coverArtDate !== +track.date && + language.$('releaseInfo.artReleased', { + date: language.formatDate(track.coverArtDate), + }), + track.duration && language.$('releaseInfo.duration', { + duration: language.formatDuration( + track.duration + ), + }), + ].filter(Boolean).join('
\n')), + + html.tag('p', + (track.urls?.length + ? language.$('releaseInfo.listenOn', { + links: language.formatDisjunctionList( + track.urls.map((url) => + fancifyURL(url, {language}) + ) + ), + }) + : language.$('releaseInfo.listenOn.noLinks'))), + + ...otherReleases.length ? [ + html.tag('p', language.$('releaseInfo.alsoReleasedAs')), + html.tag('ul', otherReleases.map(track => + html.tag('li', language.$('releaseInfo.alsoReleasedAs.item', { + track: link.track(track), + album: link.album(track.album), + })))), + ] : [], + + ...track.contributorContribs.length ? [ + html.tag('p', language.$('releaseInfo.contributors')), + html.tag('ul', track.contributorContribs.map(contrib => + html.tag('li', getArtistString([contrib], { + showContrib: true, + showIcons: true, + })))), + ] : [], + + ...referencedTracks.length ? [ + html.tag('p', language.$('releaseInfo.tracksReferenced', { + track: html.tag('i', track.name), + })), + html.tag('ul', referencedTracks.map(getTrackItem)), + ] : [], + + ...referencedByTracks.length ? [ + html.tag('p', language.$('releaseInfo.tracksThatReference', { + track: html.tag('i', track.name), + })), + generateTrackListDividedByGroups(referencedByTracks, { + getTrackItem, + wikiData, + }), + ] : [], + + ...(wikiInfo.enableFlashesAndGames && flashesThatFeature.length) ? [ + html.tag('p', language.$('releaseInfo.flashesThatFeature', { + track: `${track.name}`, + })), + html.tag('ul', flashesThatFeature.map(({flash, as}) => + html.tag('li', + {class: as !== track && 'rerelease'}, + (as === track + ? language.$('releaseInfo.flashesThatFeature.item', { + flash: link.flash(flash), + }) + : language.$('releaseInfo.flashesThatFeature.item.asDifferentRelease', { + flash: link.flash(flash), + track: link.track(as), + }))))), + ] : [], + + ...track.lyrics ? [ + html.tag('p', language.$('releaseInfo.lyrics')), + html.tag('blockquote', transformLyrics(track.lyrics)), + ] : [], + + ...hasCommentary ? [ + html.tag('p', language.$('releaseInfo.artistCommentary')), + html.tag('blockquote', generateCommentary({ + link, + language, + transformMultiline, + })), + ] : [], + ].filter(Boolean).join('\n'), }, sidebarLeft: generateAlbumSidebar(album, track, { -- cgit 1.3.0-6-gf8a5