« get me outta code hell

content: linkContribution: use nowrap when accents present - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-15 17:15:06 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-15 17:15:06 -0300
commite85c7b765c106006d45befcefa23789c3c57484c (patch)
tree9917a2760634ace3114e31f5563bb7c8cf8211e6 /src
parent073d9377d63eebf5eafbee41a8097f0bb94b13ef (diff)
content: linkContribution: use nowrap when accents present
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/linkContribution.js41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/content/dependencies/linkContribution.js b/src/content/dependencies/linkContribution.js
index cc0cb353..210d5b01 100644
--- a/src/content/dependencies/linkContribution.js
+++ b/src/content/dependencies/linkContribution.js
@@ -41,25 +41,26 @@ export default {
         {[html.noEdgeWhitespace]: true, class: 'icons'},
         language.formatUnitList(relations.artistIcons));
 
+    const parts = ['misc.artistLink'];
+    const options = {artist: relations.artistLink};
+
+    if (hasContributionPart) {
+      parts.push('withContribution');
+      options.contrib = data.contribution;
+    }
+
+    if (hasExternalPart) {
+      parts.push('withExternalLinks');
+      options.links = externalLinks;
+    }
+
+    const content = language.formatString(parts.join('.'), options);
+
     return (
-      (hasContributionPart
-        ? (hasExternalPart
-            ? language.$('misc.artistLink.withContribution.withExternalLinks', {
-                artist: relations.artistLink,
-                contrib: data.contribution,
-                links: externalLinks,
-              })
-            : language.$('misc.artistLink.withContribution', {
-                artist: relations.artistLink,
-                contrib: data.contribution,
-              }))
-        : (hasExternalPart
-            ? language.$('misc.artistLink.withExternalLinks', {
-                artist: relations.artistLink,
-                links: externalLinks,
-              })
-            : language.$('misc.artistLink', {
-                artist: relations.artistLink,
-              }))));
-  },
+      (parts.length > 1
+        ? html.tag('span',
+            {[html.noEdgeWhitespace]: true, class: 'nowrap'},
+            content)
+        : content));
+    },
 };