From 2fa9baf09753243cc223859c06abad8abfc9bf2a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 10 May 2022 20:34:15 -0300 Subject: rename list utilities --- src/listing-spec.js | 2 +- src/misc-templates.js | 6 +++--- src/page/album.js | 4 ++-- src/page/artist.js | 12 ++++++------ src/page/flash.js | 2 +- src/page/group.js | 2 +- src/page/track.js | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/listing-spec.js b/src/listing-spec.js index c583a4d1..6df89978 100644 --- a/src/listing-spec.js +++ b/src/listing-spec.js @@ -639,7 +639,7 @@ const listingSpec = [ ${(tracks .map(track => language.$('listingPage.listTracks.inFlashes.byAlbum.track', { track: link.track(track), - flashes: strings.list.and(track.featuredInFlashes.map(link.flash)) + flashes: language.formatConjunctionList(track.featuredInFlashes.map(link.flash)) })) .map(row => `
  • ${row}
  • `) .join('\n'))} diff --git a/src/misc-templates.js b/src/misc-templates.js index 3c0b2b73..93d9eabb 100644 --- a/src/misc-templates.js +++ b/src/misc-templates.js @@ -35,13 +35,13 @@ export function getArtistString(artists, { showIcons = false, showContrib = false }) { - return strings.list.and(artists.map(({ who, what }) => { + return language.formatConjunctionList(artists.map(({ who, what }) => { const { urls, directory, name } = who; return [ link.artist(who), showContrib && what && `(${what})`, showIcons && urls?.length && `(${ - strings.list.unit(urls.map(url => iconifyURL(url, {strings}))) + language.formatUnitList(urls.map(url => iconifyURL(url, {strings}))) })` ].filter(Boolean).join(' '); })); @@ -117,7 +117,7 @@ export function getRevealStringFromWarnings(warnings, {strings}) { export function getRevealStringFromTags(tags, {strings}) { return tags && tags.some(tag => tag.isContentWarning) && ( - getRevealStringFromWarnings(strings.list.unit(tags.filter(tag => tag.isContentWarning).map(tag => tag.name)), {strings})); + getRevealStringFromWarnings(language.formatUnitList(tags.filter(tag => tag.isContentWarning).map(tag => tag.name)), {strings})); } // Cover art links diff --git a/src/page/album.js b/src/page/album.js index 448ef72e..d24ebafd 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -190,7 +190,7 @@ export function write(album, {wikiData}) { }

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

    ${ language.$('releaseInfo.listenOn', { - links: strings.list.or(album.urls.map(url => fancifyURL(url, {album: true}))) + links: language.formatDisjunctionList(album.urls.map(url => fancifyURL(url, {album: true}))) }) }

    `} ${album.trackGroups && (album.trackGroups.length > 1 || !album.trackGroups[0].isDefaultTrackGroup) ? fixWS` @@ -342,7 +342,7 @@ export function generateAlbumSidebar(album, currentTrack, { ${!currentTrack && transformMultiline(group.descriptionShort)} ${group.urls?.length && `

    ${ language.$('releaseInfo.visitOn', { - links: strings.list.or(group.urls.map(url => fancifyURL(url))) + links: language.formatDisjunctionList(group.urls.map(url => fancifyURL(url))) }) }

    `} ${!currentTrack && fixWS` diff --git a/src/page/artist.js b/src/page/artist.js index 7d28feec..68eaf53b 100644 --- a/src/page/artist.js +++ b/src/page/artist.js @@ -149,7 +149,7 @@ export function write(artist, {wikiData}) { ? language.$('artistPage.creditList.entry.withArtists.withContribution', { entry, artists: getArtistString(artists), - contribution: (contrib.whatArray ? strings.list.unit(contrib.whatArray) : contrib.what) + contribution: (contrib.whatArray ? language.formatUnitList(contrib.whatArray) : contrib.what) }) : language.$('artistPage.creditList.entry.withArtists', { entry, @@ -158,7 +158,7 @@ export function write(artist, {wikiData}) { : ((contrib.what || contrib.whatArray?.length) ? language.$('artistPage.creditList.entry.withContribution', { entry, - contribution: (contrib.whatArray ? strings.list.unit(contrib.whatArray) : contrib.what) + contribution: (contrib.whatArray ? language.formatUnitList(contrib.whatArray) : contrib.what) }) : entry))); @@ -300,7 +300,7 @@ export function write(artist, {wikiData}) {
    `} ${urls?.length && `

    ${language.$('releaseInfo.visitOn', { - links: strings.list.or(urls.map(url => fancifyURL(url, {strings}))) + links: language.formatDisjunctionList(urls.map(url => fancifyURL(url, {strings}))) })}

    `} ${hasGallery && `

    ${language.$('artistPage.viewArtGallery', { link: link.artistGallery(artist, { @@ -308,7 +308,7 @@ export function write(artist, {wikiData}) { }) })}

    `}

    ${language.$('misc.jumpTo.withLinks', { - links: strings.list.unit([ + links: language.formatUnitList([ allTracks.length && `${language.$('artistPage.trackList.title')}`, artThingsAll.length && `${language.$('artistPage.artList.title')}`, wikiInfo.enableFlashesAndGames && flashes.length && `${language.$('artistPage.flashList.title')}`, @@ -322,7 +322,7 @@ export function write(artist, {wikiData}) { duration: language.formatDuration(totalDuration, {approximate: true, unit: true}) })}

    ${language.$('artistPage.musicGroupsLine', { - groups: strings.list.unit(musicGroups + groups: language.formatUnitList(musicGroups .map(({ group, contributions }) => language.$('artistPage.groupsLine.item', { group: link.groupInfo(group), contributions: language.countContributions(contributions) @@ -338,7 +338,7 @@ export function write(artist, {wikiData}) { }) })}

    `}

    ${language.$('artistPage.artGroupsLine', { - groups: strings.list.unit(artGroups + groups: language.formatUnitList(artGroups .map(({ group, contributions }) => language.$('artistPage.groupsLine.item', { group: link.groupInfo(group), contributions: language.countContributions(contributions) diff --git a/src/page/flash.js b/src/page/flash.js index fe72a8bd..97824e07 100644 --- a/src/page/flash.js +++ b/src/page/flash.js @@ -50,7 +50,7 @@ export function write(flash, {wikiData}) { })}

    ${language.$('releaseInfo.released', {date: language.formatDate(flash.date)})}

    ${(flash.page || flash.urls?.length) && `

    ${language.$('releaseInfo.playOn', { - links: strings.list.or([ + links: language.formatDisjunctionList([ flash.page && getFlashLink(flash), ...flash.urls ?? [] ].map(url => fancifyFlashURL(url, flash))) diff --git a/src/page/group.js b/src/page/group.js index 0467cada..1aea3fb1 100644 --- a/src/page/group.js +++ b/src/page/group.js @@ -50,7 +50,7 @@ export function write(group, {wikiData}) {

    ${language.$('groupInfoPage.title', {group: group.name})}

    ${group.urls?.length && `

    ${ language.$('releaseInfo.visitOn', { - links: strings.list.or(group.urls.map(url => fancifyURL(url, {strings}))) + links: language.formatDisjunctionList(group.urls.map(url => fancifyURL(url, {strings}))) }) }

    `}
    diff --git a/src/page/track.js b/src/page/track.js index 295f4257..7cc6d5ab 100644 --- a/src/page/track.js +++ b/src/page/track.js @@ -196,7 +196,7 @@ export function write(track, {wikiData}) {

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

    -- cgit 1.3.0-6-gf8a5