« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateTrackList.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateTrackList.js')
-rw-r--r--src/content/dependencies/generateTrackList.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/content/dependencies/generateTrackList.js b/src/content/dependencies/generateTrackList.js
index 4760ff2f..bc3b6035 100644
--- a/src/content/dependencies/generateTrackList.js
+++ b/src/content/dependencies/generateTrackList.js
@@ -31,14 +31,16 @@ export default {
         contributionLinks: relations.contributionLinks,
       }).map(({trackLink, contributionLinks}) =>
           html.tag('li',
-            (empty(contributionLinks)
-              ? trackLink
-              : language.$('trackList.item.withArtists', {
-                  track: trackLink,
-                  by:
+            language.encapsulate('trackList.item', itemCapsule =>
+              language.encapsulate(itemCapsule, workingCapsule => {
+                const workingOptions = {track: trackLink};
+
+                if (!empty(contributionLinks)) {
+                  workingCapsule += '.withArtists';
+                  workingOptions.by =
                     html.tag('span', {class: 'by'},
                       html.metatag('chunkwrap', {split: ','},
-                        language.$('trackList.item.withArtists.by', {
+                        language.$(itemCapsule, 'withArtists.by', {
                           artists:
                             language.formatConjunctionList(
                               contributionLinks.map(link =>
@@ -46,6 +48,9 @@ export default {
                                   showContribution: slots.showContribution,
                                   showIcons: slots.showIcons,
                                 }))),
-                        }))),
-                }))))),
+                        })));
+                }
+
+                return language.$(workingCapsule, workingOptions);
+              }))))),
 };