From 687783a53deecddc9d43020a5c10c5800fa37796 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 8 Feb 2022 09:40:15 -0400 Subject: tidy find() regex and update data key --- src/util/find.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/util') 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') }; -- cgit 1.3.0-6-gf8a5