« 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/dependencies/transformContent.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/transformContent.js')
-rw-r--r--src/content/dependencies/transformContent.js21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js
index b2d878ac..4079f0f0 100644
--- a/src/content/dependencies/transformContent.js
+++ b/src/content/dependencies/transformContent.js
@@ -3,6 +3,7 @@ import {basename} from 'node:path';
 import {logWarn} from '#cli';
 import {bindFind} from '#find';
 import {replacerSpec, parseContentNodes} from '#replacer';
+import {errors} from '#sugar';
 
 import {Marked} from 'marked';
 import striptags from 'striptags';
@@ -625,28 +626,12 @@ export default {
             if (hash) link.setSlot('hash', hash);
 
             // TODO: This is obviously hacky.
-            let hasPreferShortNameSlot;
-            try {
-              link.getSlotDescription('preferShortName');
-              hasPreferShortNameSlot = true;
-            } catch {
-              hasPreferShortNameSlot = false;
-            }
-
-            if (hasPreferShortNameSlot) {
+            if (!errors(() => link.getSlotDescription('preferShortName'))) {
               link.setSlot('preferShortName', slots.preferShortLinkNames);
             }
 
             // TODO: The same, the same.
-            let hasTooltipStyleSlot;
-            try {
-              link.getSlotDescription('tooltipStyle');
-              hasTooltipStyleSlot = true;
-            } catch {
-              hasTooltipStyleSlot = false;
-            }
-
-            if (hasTooltipStyleSlot) {
+            if (!errors(() => link.getSlotDescription('tooltipStyle'))) {
               link.setSlot('tooltipStyle', 'none');
             }