« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/generateArtistInfoPageChunk.js10
-rw-r--r--src/content/dependencies/generateArtistInfoPageChunkItem.js19
2 files changed, 22 insertions, 7 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageChunk.js b/src/content/dependencies/generateArtistInfoPageChunk.js
index c16d50f3..820c01e0 100644
--- a/src/content/dependencies/generateArtistInfoPageChunk.js
+++ b/src/content/dependencies/generateArtistInfoPageChunk.js
@@ -29,6 +29,11 @@ export default {
 
     duration: {validate: v => v.isDuration},
     durationApproximate: {type: 'boolean'},
+
+    trimAnnotations: {
+      type: 'boolean',
+      default: false,
+    },
   },
 
   generate(slots, {html, language}) {
@@ -102,7 +107,10 @@ export default {
       html.tag('dt', accentedLink),
       html.tag('dd',
         html.tag('ul',
-          slots.items)),
+          slots.items
+            .map(item => item.slots({
+              trimAnnotation: slots.trimAnnotations,
+            })))),
     ]);
   },
 };
diff --git a/src/content/dependencies/generateArtistInfoPageChunkItem.js b/src/content/dependencies/generateArtistInfoPageChunkItem.js
index 9d406c67..0ec7b1ec 100644
--- a/src/content/dependencies/generateArtistInfoPageChunkItem.js
+++ b/src/content/dependencies/generateArtistInfoPageChunkItem.js
@@ -9,16 +9,18 @@ export default {
       mutable: false,
     },
 
-    annotation: {
-      type: 'html',
-      mutable: false,
-    },
+    annotation: {type: 'string'},
 
     otherArtistLinks: {
       validate: v => v.strictArrayOf(v.isHTML),
     },
 
     rerelease: {type: 'boolean'},
+
+    trimAnnotation: {
+      type: 'boolean',
+      default: false,
+    },
   },
 
   generate: (slots, {html, language}) =>
@@ -43,10 +45,15 @@ export default {
               language.formatConjunctionList(slots.otherArtistLinks);
           }
 
-          if (!html.isBlank(slots.annotation)) {
+          const annotation =
+            (slots.trimAnnotation
+              ? slots.annotation?.replace(/^edits for wiki(: )?/, '')
+              : slots.annotation);
+
+          if (annotation) {
             anyAccent = true;
             workingCapsule += '.withAnnotation';
-            workingOptions.annotation = slots.annotation;
+            workingOptions.annotation = annotation;
           }
 
           if (anyAccent) {