diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-02-08 09:40:15 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-02-08 09:40:15 -0400 |
commit | 687783a53deecddc9d43020a5c10c5800fa37796 (patch) | |
tree | 8dd56efdfd9d0d01f19f50a06b5d7368b3974602 | |
parent | 80ef2108d9ce2ee5bb8c3cae562a7257710a7f23 (diff) |
tidy find() regex and update data key
-rw-r--r-- | src/util/find.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/find.js b/src/util/find.js index 423046b3..0e220634 100644 --- a/src/util/find.js +++ b/src/util/find.js @@ -7,7 +7,7 @@ function findHelper(keys, dataProp, findFns = {}) { const byDirectory = findFns.byDirectory || matchDirectory; const byName = findFns.byName || matchName; - const keyRefRegex = new RegExp(`^((${keys.join('|')}):(?:\S))?(.*)$`); + const keyRefRegex = new RegExp(String.raw`^(?:(${keys.join('|')}):(?=\S))?(.*)$`); return (fullRef, {wikiData}) => { if (!fullRef) return null; @@ -21,7 +21,7 @@ function findHelper(keys, dataProp, findFns = {}) { } const key = match[1]; - const ref = match[3]; + const ref = match[2]; const data = wikiData[dataProp]; @@ -78,7 +78,7 @@ const find = { listing: findHelper(['listing'], 'listingSpec'), newsEntry: findHelper(['news-entry'], 'newsData'), staticPage: findHelper(['static'], 'staticPageData'), - tag: findHelper(['tag'], 'tagData', {byName: matchTagName}), + tag: findHelper(['tag'], 'artTagData', {byName: matchTagName}), track: findHelper(['track'], 'trackData') }; |