« get me outta code hell

specify unique string per chronology heading word - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-03-05 21:58:39 -0400
committer(quasar) nebula <towerofnix@gmail.com>2021-03-05 21:58:39 -0400
commit7462e5126a387c2bd35dbb66f972f68ebaf42a84 (patch)
treede652c5a605332fbd903d178313efa255855a3c5
parent4dc9ec8a3de5825fe92987711971c4f862c39e5e (diff)
specify unique string per chronology heading word
-rw-r--r--strings-default.json7
-rwxr-xr-xupd8.js19
2 files changed, 13 insertions, 13 deletions
diff --git a/strings-default.json b/strings-default.json
index 10430c77..d9ab89a7 100644
--- a/strings-default.json
+++ b/strings-default.json
@@ -67,10 +67,9 @@
     "misc.alt.artistAvatar": "artist avatar",
     "misc.alt.flashArt": "flash art",
     "misc.chronology.seeArtistPages": "(See artist pages for chronology info!)",
-    "misc.chronology.heading": "{INDEX} {WORD} by {ARTIST}",
-    "misc.chronology.coverArt": "cover art",
-    "misc.chronology.flash": "flash/game",
-    "misc.chronology.track": "track",
+    "misc.chronology.heading.coverArt": "Cover art {INDEX} by {ARTIST}",
+    "misc.chronology.heading.flash": "Flash/game {INDEX} by {ARTIST}",
+    "misc.chronology.heading.track": "Track {INDEX} by {ARTIST}",
     "misc.external.bandcamp": "Bandcamp",
     "misc.external.bandcamp.domain": "Bandcamp ({DOMAIN})",
     "misc.external.deviantart": "DeviantArt",
diff --git a/upd8.js b/upd8.js
index 12549c5c..61a6ee8c 100755
--- a/upd8.js
+++ b/upd8.js
@@ -3487,7 +3487,7 @@ function generateNavForFlash(flash, {strings, to}) {
             <div>
                 ${chronologyLinks(flash, {
                     strings, to,
-                    headingWord: strings('misc.chronology.flash'),
+                    headingString: 'misc.chronology.heading.flash',
                     contribKey: 'contributors',
                     getThings: artist => artist.flashes.asContributor
                 })}
@@ -4702,7 +4702,7 @@ function iconifyURL(url) {
 
 function chronologyLinks(currentThing, {
     strings, to,
-    headingWord,
+    headingString,
     contribKey,
     getThings
 }) {
@@ -4734,13 +4734,14 @@ function chronologyLinks(currentThing, {
             next && `<a href="${toAnythingMan(next, to)}" title="${next.name}">Next</a>`
         ].filter(Boolean);
 
+        const stringOpts = {
+            index: strings.count.index(index + 1, {strings}),
+            artist: strings.link.artist(artist, {to})
+        };
+
         return fixWS`
             <div class="chronology">
-                <span class="heading">${strings('misc.chronology.heading', {
-                    index: strings.count.index(index + 1),
-                    word: headingWord,
-                    artist: strings.link.artist(artist, {to})
-                })}</span>
+                <span class="heading">${strings(headingString, stringOpts)}</span>
                 ${parts.length && `<span class="buttons">(${parts.join(', ')})</span>`}
             </div>
         `;
@@ -4768,13 +4769,13 @@ function generateAlbumChronologyLinks(album, currentTrack, {strings, to}) {
     return [
         currentTrack && chronologyLinks(currentTrack, {
             strings, to,
-            headingWord: strings('misc.chronology.track'),
+            headingString: 'misc.chronology.heading.track',
             contribKey: 'artists',
             getThings: artist => [...artist.tracks.asArtist, ...artist.tracks.asContributor]
         }),
         chronologyLinks(currentTrack || album, {
             strings, to,
-            headingWord: strings('misc.chronology.coverArt'),
+            headingString: 'misc.chronology.heading.coverArt',
             contribKey: 'coverArtists',
             getThings: artist => [...artist.albums.asCoverArtist, ...artist.tracks.asCoverArtist]
         })