« get me outta code hell

data, content: Artwork.{label,source} - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-04-02 13:13:20 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:38 -0300
commit883c5209f4e78600b851238646bbdcaafdcc210b (patch)
treeddefa94bf7fb75f4e1283f8318302d64a3b94241 /src/content/dependencies
parent5bbecc7e2e9a4836ba3ee8323e685bf70ef51f32 (diff)
data, content: Artwork.{label,source}
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateArtistCredit.js18
-rw-r--r--src/content/dependencies/generateCoverArtworkOriginDetails.js25
2 files changed, 37 insertions, 6 deletions
diff --git a/src/content/dependencies/generateArtistCredit.js b/src/content/dependencies/generateArtistCredit.js
index 72d55854..6bdbeb23 100644
--- a/src/content/dependencies/generateArtistCredit.js
+++ b/src/content/dependencies/generateArtistCredit.js
@@ -80,6 +80,8 @@ export default {
     // It won't be used if contextContributions isn't provided.
     featuringStringKey: {type: 'string'},
 
+    additionalStringOptions: {validate: v => v.isObject},
+
     showAnnotation: {type: 'boolean', default: false},
     showExternalLinks: {type: 'boolean', default: false},
     showChronology: {type: 'boolean', default: false},
@@ -148,7 +150,10 @@ export default {
 
     if (empty(relations.featuringContributionLinks)) {
       if (data.normalContributionsDifferFromContext) {
-        return language.$(slots.normalStringKey, {artists: artistsList});
+        return language.$(slots.normalStringKey, {
+          ...slots.additionalStringOptions,
+          artists: artistsList,
+        });
       } else {
         return html.blank();
       }
@@ -156,13 +161,20 @@ export default {
 
     if (data.normalContributionsDifferFromContext && slots.normalFeaturingStringKey) {
       return language.$(slots.normalFeaturingStringKey, {
+        ...slots.additionalStringOptions,
         artists: artistsList,
         featuring: featuringList,
       });
     } else if (slots.featuringStringKey) {
-      return language.$(slots.featuringStringKey, {artists: featuringList});
+      return language.$(slots.featuringStringKey, {
+        ...slots.additionalStringOptions,
+        artists: featuringList,
+      });
     } else {
-      return language.$(slots.normalStringKey, {artists: everyoneList});
+      return language.$(slots.normalStringKey, {
+        ...slots.additionalStringOptions,
+        artists: everyoneList,
+      });
     }
   },
 };
diff --git a/src/content/dependencies/generateCoverArtworkOriginDetails.js b/src/content/dependencies/generateCoverArtworkOriginDetails.js
index 8b5a28ac..83f5ae8a 100644
--- a/src/content/dependencies/generateCoverArtworkOriginDetails.js
+++ b/src/content/dependencies/generateCoverArtworkOriginDetails.js
@@ -1,13 +1,19 @@
 export default {
-  contentDependencies: ['generateArtistCredit'],
+  contentDependencies: ['generateArtistCredit', 'transformContent'],
   extraDependencies: ['html', 'language'],
 
   relations: (relation, artwork) => ({
     credit:
       relation('generateArtistCredit', artwork.artistContribs, []),
+
+    source:
+      relation('transformContent', artwork.source),
   }),
 
   data: (artwork) => ({
+    label:
+      artwork.label,
+
     date:
       (artwork.date !== artwork.thing.date
         ? artwork.date
@@ -33,12 +39,25 @@ export default {
 
             chronologyKind: 'coverArt',
 
-            normalStringKey: capsule + '.artworkBy',
+            normalStringKey:
+              (data.label
+                ? capsule + '.artworkBy.customLabel'
+                : capsule + '.artworkBy'),
+
+            additionalStringOptions:
+              (data.label
+                ? {label: data.label}
+                : {}),
           }),
 
           language.$(capsule, 'released', {
             [language.onlyIfOptions]: ['date'],
             date: language.formatDate(data.date),
-          })
+          }),
+
+          language.$(capsule, 'source', {
+            [language.onlyIfOptions]: ['source'],
+            source: relations.source.slot('mode', 'inline'),
+          }),
         ])),
 };