« get me outta code hell

refine link/ref resolving & data post-processing - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util/replacer.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-01-03 23:23:12 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-01-03 23:23:12 -0400
commit416b7261fa3c9e3d0873fdc9faf501014462e06c (patch)
tree2a67c7b0bdc2d4fd98d700207e33ac166165280e /src/util/replacer.js
parent22e1c9e1f57a9d2252b6bc614ca8abb805721d4d (diff)
refine link/ref resolving & data post-processing
Diffstat (limited to 'src/util/replacer.js')
-rw-r--r--src/util/replacer.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/util/replacer.js b/src/util/replacer.js
index 0c16dc8..6c52477 100644
--- a/src/util/replacer.js
+++ b/src/util/replacer.js
@@ -324,7 +324,10 @@ function evaluateTag(node, opts) {
 
     const source = input.slice(node.i, node.iEnd);
 
-    const replacerKey = node.data.replacerKey?.data || 'track';
+    const replacerKeyImplied = !node.data.replacerKey;
+    const replacerKey = (replacerKeyImplied
+        ? 'track'
+        : node.data.replacerKey.data);
 
     if (!replacerSpec[replacerKey]) {
         logWarn`The link ${source} has an invalid replacer key!`;
@@ -343,7 +346,9 @@ function evaluateTag(node, opts) {
 
     const value = (
         valueFn ? valueFn(replacerValue) :
-        findKey ? find[findKey](replacerValue, {wikiData}) :
+        findKey ? find[findKey]((replacerKeyImplied
+            ? replacerValue
+            : replacerKey + `:` + replacerValue), {wikiData}) :
         {
             directory: replacerValue,
             name: null