« get me outta code hell

content: linkContribution: trimAnnotation slot - 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>2024-08-15 13:10:03 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-08-15 13:38:20 -0300
commita121af54628ed4449d5c9a3eb0284f6f732254df (patch)
tree41197ceed1f5aefb48ef46ef6496a539a11cc60c
parenta94621687429e177b1bd3c7bb23ce5afd08e8135 (diff)
content: linkContribution: trimAnnotation slot
-rw-r--r--src/content/dependencies/linkContribution.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/content/dependencies/linkContribution.js b/src/content/dependencies/linkContribution.js
index 0c5ec8f4..c658d461 100644
--- a/src/content/dependencies/linkContribution.js
+++ b/src/content/dependencies/linkContribution.js
@@ -28,8 +28,11 @@ export default {
     showExternalLinks: {type: 'boolean', default: false},
     showChronology: {type: 'boolean', default: false},
 
+    trimAnnotation: {type: 'boolean', default: false},
+
     preventWrapping: {type: 'boolean', default: true},
     preventTooltip: {type: 'boolean', default: false},
+
     chronologyKind: {type: 'string'},
   },
 
@@ -67,10 +70,14 @@ export default {
                   relations.tooltip,
               }));
 
-        if (slots.showAnnotation && data.annotation) {
+        const annotation =
+          (slots.trimAnnotation
+            ? data.annotation?.replace(/^edits for wiki(: )?/, '')
+            : data.annotation);
+
+        if (slots.showAnnotation && annotation) {
           workingCapsule += '.withContribution';
-          workingOptions.contrib =
-            data.annotation;
+          workingOptions.contrib = annotation;
         }
 
         return language.formatString(workingCapsule, workingOptions);