diff options
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 |
commit | 416b7261fa3c9e3d0873fdc9faf501014462e06c (patch) | |
tree | 2a67c7b0bdc2d4fd98d700207e33ac166165280e /src/util/replacer.js | |
parent | 22e1c9e1f57a9d2252b6bc614ca8abb805721d4d (diff) |
refine link/ref resolving & data post-processing
Diffstat (limited to 'src/util/replacer.js')
-rw-r--r-- | src/util/replacer.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/util/replacer.js b/src/util/replacer.js index 0c16dc8b..6c524778 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 |