« get me outta code hell

rename list utilities - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-05-10 20:34:15 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-05-10 20:34:15 -0300
commit2fa9baf09753243cc223859c06abad8abfc9bf2a (patch)
tree35f2a07b0f64eb058cf8e9bb08e540f5a1cf6013
parent2caa1edb5984a17b41a2144e8e59583798bd53e9 (diff)
rename list utilities
-rw-r--r--src/listing-spec.js2
-rw-r--r--src/misc-templates.js6
-rw-r--r--src/page/album.js4
-rw-r--r--src/page/artist.js12
-rw-r--r--src/page/flash.js2
-rw-r--r--src/page/group.js2
-rw-r--r--src/page/track.js2
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 => `<li>${row}</li>`)
                                 .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 && `<span class="icons">(${
-                strings.list.unit(urls.map(url => iconifyURL(url, {strings})))
+                language.formatUnitList(urls.map(url => iconifyURL(url, {strings})))
             })</span>`
         ].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}) {
                         }</p>`}
                         ${album.urls?.length && `<p>${
                             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})))
                             })
                         }</p>`}
                         ${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 && `<p>${
             language.$('releaseInfo.visitOn', {
-                links: strings.list.or(group.urls.map(url => fancifyURL(url)))
+                links: language.formatDisjunctionList(group.urls.map(url => fancifyURL(url)))
             })
         }</p>`}
         ${!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}) {
                             <hr>
                         `}
                         ${urls?.length && `<p>${language.$('releaseInfo.visitOn', {
-                            links: strings.list.or(urls.map(url => fancifyURL(url, {strings})))
+                            links: language.formatDisjunctionList(urls.map(url => fancifyURL(url, {strings})))
                         })}</p>`}
                         ${hasGallery && `<p>${language.$('artistPage.viewArtGallery', {
                             link: link.artistGallery(artist, {
@@ -308,7 +308,7 @@ export function write(artist, {wikiData}) {
                             })
                         })}</p>`}
                         <p>${language.$('misc.jumpTo.withLinks', {
-                            links: strings.list.unit([
+                            links: language.formatUnitList([
                                 allTracks.length && `<a href="#tracks">${language.$('artistPage.trackList.title')}</a>`,
                                 artThingsAll.length && `<a href="#art">${language.$('artistPage.artList.title')}</a>`,
                                 wikiInfo.enableFlashesAndGames && flashes.length && `<a href="#flashes">${language.$('artistPage.flashList.title')}</a>`,
@@ -322,7 +322,7 @@ export function write(artist, {wikiData}) {
                                 duration: language.formatDuration(totalDuration, {approximate: true, unit: true})
                             })}</p>
                             <p>${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}) {
                                 })
                             })}</p>`}
                             <p>${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}) {
                     })}
                     <p>${language.$('releaseInfo.released', {date: language.formatDate(flash.date)})}</p>
                     ${(flash.page || flash.urls?.length) && `<p>${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}) {
                     <h1>${language.$('groupInfoPage.title', {group: group.name})}</h1>
                     ${group.urls?.length && `<p>${
                         language.$('releaseInfo.visitOn', {
-                            links: strings.list.or(group.urls.map(url => fancifyURL(url, {strings})))
+                            links: language.formatDisjunctionList(group.urls.map(url => fancifyURL(url, {strings})))
                         })
                     }</p>`}
                     <blockquote>
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}) {
                         <p>${
                             (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'))
                         }</p>