From a121af54628ed4449d5c9a3eb0284f6f732254df Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 15 Aug 2024 13:10:03 -0300 Subject: content: linkContribution: trimAnnotation slot --- src/content/dependencies/linkContribution.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/content/dependencies') 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); -- cgit 1.3.0-6-gf8a5