diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-05-01 16:50:50 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-05-06 12:29:06 -0300 |
commit | 928a8247048d3476d46b0e8817f11fc5b068506a (patch) | |
tree | bace6d72e1cfe502104936c3632d2cb9394887e4 /src/common-util | |
parent | 2e5b3352a3ab82e4d6fa249f3c74fb8a1f8fad04 (diff) |
data: ContentEntry: implicit references via artistText
Diffstat (limited to 'src/common-util')
-rw-r--r-- | src/common-util/wiki-data.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/common-util/wiki-data.js b/src/common-util/wiki-data.js index b21af786..546f1ad9 100644 --- a/src/common-util/wiki-data.js +++ b/src/common-util/wiki-data.js @@ -57,10 +57,9 @@ export function getKebabCase(name) { // Specific data utilities -// Matches heading details from commentary data in roughly the formats: +// Matches heading details from commentary data in roughly the format: // -// <i>artistReference:</i> (annotation, date) -// <i>artistReference|artistText:</i> (annotation, date) +// <i>artistText:</i> (annotation, date) // // where capturing group "annotation" can be any text at all, except that the // last entry (past a comma or the only content within parentheses), if parsed @@ -95,7 +94,7 @@ const dateRegex = groupName => String.raw`(?<${groupName}>[a-zA-Z]+ [0-9]{1,2}, [0-9]{4,4}|[0-9]{1,2} [^,]*[0-9]{4,4}|[0-9]{1,4}[-/][0-9]{1,4}[-/][0-9]{1,4})`; const commentaryRegexRaw = - String.raw`^<i>(?<artistReferences>.+?)(?:\|(?<artistText>.+))?:<\/i>(?: \((?<annotation>(?:.*?(?=,|\)[^)]*$))*?)(?:,? ?(?:(?<dateKind>sometime|throughout|around) )?${dateRegex('date')}(?: ?- ?${dateRegex('secondDate')})?(?: (?<accessKind>captured|accessed) ${dateRegex('accessDate')})?)?\))?`; + String.raw`^<i>(?<artistText>.+?):<\/i>(?: \((?<annotation>(?:.*?(?=,|\)[^)]*$))*?)(?:,? ?(?:(?<dateKind>sometime|throughout|around) )?${dateRegex('date')}(?: ?- ?${dateRegex('secondDate')})?(?: (?<accessKind>captured|accessed) ${dateRegex('accessDate')})?)?\))?`; export const commentaryRegexCaseInsensitive = new RegExp(commentaryRegexRaw, 'gmi'); export const commentaryRegexCaseSensitive = |