« 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
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateArtistCredit.js23
-rw-r--r--src/content/dependencies/generateArtistCreditWikiEditsPart.js1
-rw-r--r--src/content/dependencies/generateArtistInfoPageTracksChunkItem.js14
-rw-r--r--src/content/dependencies/generateCoverArtworkOriginDetails.js2
-rw-r--r--src/content/dependencies/generateReleaseInfoContributionsLine.js2
-rw-r--r--src/content/dependencies/linkContribution.js17
6 files changed, 19 insertions, 40 deletions
diff --git a/src/content/dependencies/generateArtistCredit.js b/src/content/dependencies/generateArtistCredit.js
index 600d73d9..35603610 100644
--- a/src/content/dependencies/generateArtistCredit.js
+++ b/src/content/dependencies/generateArtistCredit.js
@@ -5,10 +5,10 @@ export default {
     const query = {};
 
     const featuringFilter = contribution =>
-      contribution.annotation === 'featuring';
+      contribution.isFeaturingCredit;
 
     const wikiEditFilter = contribution =>
-      contribution.annotation?.startsWith('edits for wiki');
+      contribution.isEditsForWikiCredit;
 
     const normalFilter = contribution =>
       !featuringFilter(contribution) &&
@@ -104,8 +104,6 @@ export default {
     showChronology: {type: 'boolean', default: false},
     showWikiEdits: {type: 'boolean', default: false},
 
-    trimAnnotation: {type: 'boolean', default: false},
-
     chunkwrap: {type: 'boolean', default: true},
 
     chronologyKind: {type: 'string'},
@@ -123,28 +121,13 @@ export default {
       ...relations.featuringContributionLinks,
     ]) {
       link.setSlots({
+        showAnnotation: slots.showAnnotation,
         showExternalLinks: slots.showExternalLinks,
         showChronology: slots.showChronology,
-        trimAnnotation: slots.trimAnnotation,
         chronologyKind: slots.chronologyKind,
       });
     }
 
-    for (const link of relations.normalContributionLinks) {
-      link.setSlots({
-        showAnnotation: slots.showAnnotation,
-      });
-    }
-
-    for (const link of relations.featuringContributionLinks) {
-      link.setSlots({
-        showAnnotation:
-          (slots.featuringStringKey || slots.normalFeaturingStringKey
-            ? false
-            : slots.showAnnotation),
-      });
-    }
-
     let formattedArtistList = null;
 
     if (!html.isBlank(relations.formatText)) {
diff --git a/src/content/dependencies/generateArtistCreditWikiEditsPart.js b/src/content/dependencies/generateArtistCreditWikiEditsPart.js
index 4178928d..7b3d8b1a 100644
--- a/src/content/dependencies/generateArtistCreditWikiEditsPart.js
+++ b/src/content/dependencies/generateArtistCreditWikiEditsPart.js
@@ -38,7 +38,6 @@ export default {
                     relations.contributionLinks.map(link =>
                       link.slots({
                         showAnnotation: slots.showAnnotation,
-                        trimAnnotation: true,
                         preventTooltip: true,
                         preventWrapping: true,
                       }))),
diff --git a/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js b/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js
index f53e0f81..3d6e274b 100644
--- a/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js
+++ b/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js
@@ -14,7 +14,7 @@ export default {
       contribs
         .some(contrib =>
           contrib.thingProperty === 'artistContribs' &&
-          contrib.annotation !== 'featuring');
+         !contrib.isFeaturingCredit);
 
     const creditedAsContributor =
       contribs
@@ -22,9 +22,7 @@ export default {
 
     const annotatedContribs =
       contribs
-        .filter(contrib =>
-          contrib.annotation &&
-          contrib.annotation !== 'featuring');
+        .filter(contrib => !empty(contrib.annotationParts));
 
     const annotatedArtistContribs =
       annotatedContribs
@@ -117,10 +115,10 @@ export default {
     duration:
       query.track.duration,
 
-    contribAnnotations:
+    contribAnnotationParts:
       (query.displayedContributions
         ? query.displayedContributions
-            .map(contrib => contrib.annotation)
+            .flatMap(contrib => contrib.annotationParts)
         : null),
   }),
 
@@ -137,8 +135,8 @@ export default {
       firstReleaseTooltip: relations.firstReleaseTooltip,
 
       annotation:
-        (data.contribAnnotations
-          ? language.formatUnitList(data.contribAnnotations)
+        (data.contribAnnotationParts
+          ? language.formatUnitList(data.contribAnnotationParts)
           : html.blank()),
 
       content:
diff --git a/src/content/dependencies/generateCoverArtworkOriginDetails.js b/src/content/dependencies/generateCoverArtworkOriginDetails.js
index e489eea6..c8f51368 100644
--- a/src/content/dependencies/generateCoverArtworkOriginDetails.js
+++ b/src/content/dependencies/generateCoverArtworkOriginDetails.js
@@ -75,8 +75,6 @@ export default {
                 showChronology: true,
                 showWikiEdits: true,
 
-                trimAnnotation: false,
-
                 chronologyKind: 'coverArt',
 
                 normalStringKey: workingCapsule,
diff --git a/src/content/dependencies/generateReleaseInfoContributionsLine.js b/src/content/dependencies/generateReleaseInfoContributionsLine.js
index 4353ccf4..da54f8b8 100644
--- a/src/content/dependencies/generateReleaseInfoContributionsLine.js
+++ b/src/content/dependencies/generateReleaseInfoContributionsLine.js
@@ -20,8 +20,6 @@ export default {
       showChronology: true,
       showWikiEdits: true,
 
-      trimAnnotation: false,
-
       chronologyKind: slots.chronologyKind,
 
       normalStringKey: slots.stringKey,
diff --git a/src/content/dependencies/linkContribution.js b/src/content/dependencies/linkContribution.js
index aa9bdef9..f9c27724 100644
--- a/src/content/dependencies/linkContribution.js
+++ b/src/content/dependencies/linkContribution.js
@@ -11,7 +11,8 @@ export default {
   }),
 
   data: (contribution) => ({
-    annotation: contribution.annotation,
+    artistText: contribution.artistText,
+    annotationParts: contribution.annotationParts,
     urls: contribution.artist.urls,
   }),
 
@@ -22,8 +23,6 @@ export default {
     showExternalLinks: {type: 'boolean', default: false},
     showChronology: {type: 'boolean', default: false},
 
-    trimAnnotation: {type: 'boolean', default: false},
-
     preventWrapping: {type: 'boolean', default: false},
     preventTooltip: {type: 'boolean', default: false},
 
@@ -53,6 +52,12 @@ export default {
           chronologyKind: slots.chronologyKind,
         });
 
+        if (data.artistText) {
+          relations.artistLink.setSlots({
+            content: language.sanitize(data.artistText),
+          });
+        }
+
         workingOptions.artist =
           (html.isBlank(relations.tooltip) || slots.preventTooltip
             ? relations.artistLink
@@ -69,11 +74,9 @@ export default {
               }));
 
         const annotation =
-          (slots.trimAnnotation
-            ? data.annotation?.replace(/^edits for wiki(: )?/, '')
-            : data.annotation);
+          language.formatUnitList(data.annotationParts);
 
-        if (slots.showAnnotation && annotation) {
+        if (slots.showAnnotation && !html.isBlank(annotation)) {
           workingCapsule += '.withContribution';
           workingOptions.contrib = annotation;
         }