« get me outta code hell

content: listRandomPageLinks: don't hard-code parentheses - 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>2023-11-09 14:50:13 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-09 14:50:13 -0400
commit150c414044662134ddf785e7411560e3a6051a03 (patch)
tree3851fb14f9b3a069980f410f5c16efffeecc4783
parentaa30c888ea2307931c555db474d709f520c551a8 (diff)
content: listRandomPageLinks: don't hard-code parentheses
-rw-r--r--src/content/dependencies/listRandomPageLinks.js23
-rw-r--r--src/strings-default.yaml6
2 files changed, 16 insertions, 13 deletions
diff --git a/src/content/dependencies/listRandomPageLinks.js b/src/content/dependencies/listRandomPageLinks.js
index 599a82d3..87e5f5aa 100644
--- a/src/content/dependencies/listRandomPageLinks.js
+++ b/src/content/dependencies/listRandomPageLinks.js
@@ -61,17 +61,18 @@ export default {
 
           html.tag('dd',
             html.tag('ul', [
-              html.tag('li', [
-                html.tag('a',
-                  {href: '#', 'data-random': 'artist'},
-                  language.$('listingPage.other.randomPages.misc.randomArtist')),
-
-                '(' +
-                html.tag('a',
-                  {href: '#', 'data-random': 'artist-more-than-one-contrib'},
-                  language.$('listingPage.other.randomPages.misc.atLeastTwoContributions')) +
-                ')',
-              ]),
+              html.tag('li',
+                language.$('listingPage.other.randomPages.misc.randomArtist', {
+                  mainLink:
+                    html.tag('a',
+                      {href: '#', 'data-random': 'artist'},
+                      language.$('listingPage.other.randomPages.misc.randomArtist.mainLink')),
+
+                  atLeastTwoContributions:
+                    html.tag('a',
+                      {href: '#', 'data-random': 'artist-more-than-one-contrib'},
+                      language.$('listingPage.other.randomPages.misc.randomArtist.atLeastTwoContributions')),
+                })),
 
               html.tag('li',
                 html.tag('a',
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 6e975de7..bb244279 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -1574,8 +1574,10 @@ listingPage:
 
       misc:
         _: "Miscellaneous:"
-        randomArtist: "Random Artist"
-        atLeastTwoContributions: "at least 2 contributions"
+        randomArtist:
+          _: "{MAIN_LINK} ({AT_LEAST_TWO_CONTRIBUTIONS})"
+          mainLink: "Random Artist"
+          atLeastTwoContributions: "at least 2 contributions"
         randomAlbumWholeSite: "Random Album (whole site)"
         randomTrackWholeSite: "Random Track (whole site)"