« get me outta code hell

Merge branch 'commentary-entries' into album-commentary-tweaks - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util/wiki-data.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-18 20:41:08 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-18 20:41:08 -0400
commit5bc43a8bc8132a9d2cfa57937aa46fda56b663e5 (patch)
tree95f770dfa3c3bb5ed7e2abc30663b275da2973ff /src/util/wiki-data.js
parentf481591b859282e1ea5483c89552375f5570e9e5 (diff)
parente35d23f4e9492b497138dce3f21382872e329e71 (diff)
Merge branch 'commentary-entries' into album-commentary-tweaks
Diffstat (limited to 'src/util/wiki-data.js')
-rw-r--r--src/util/wiki-data.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js
index 75a141d3..5e3182a9 100644
--- a/src/util/wiki-data.js
+++ b/src/util/wiki-data.js
@@ -641,8 +641,10 @@ export function sortFlashesChronologically(data, {
 //
 //   * "25 December 2019" - one or two number digits, followed by any text,
 //     followed by four number digits
-//   * "12/25/2019" - one or two number digits, a slash, one or two number
-//     digits, a slash, and two to four number digits
+//   * "December 25, 2019" - one all-letters word, a space, one or two number
+//     digits, a comma, and four number digits
+//   * "12/25/2019" etc - three sets of one to four number digits, separated
+//     by slashes or dashes (only valid orders are MM/DD/YYYY and YYYY/MM/DD)
 //
 // Capturing group "artistReference" is all the characters between <i> and </i>
 // (apart from the pipe and "artistDisplayText" text, if present), and is either
@@ -652,7 +654,7 @@ export function sortFlashesChronologically(data, {
 // out of the original string based on the indices matched using this.
 //
 export const commentaryRegex =
-  /^<i>(?<artistReference>.+?)(?:\|(?<artistDisplayText>.+))?:<\/i>(?: \((?<annotation>(?:.*?(?=[,)]))*?)(?:,? ?(?<date>[a-zA-Z]+ [0-9]{1,2}, [0-9]{4,4}|[0-9]{1,2} [^,]*[0-9]{4,4}|[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{2,4}))?\))?/gm;
+  /^<i>(?<artistReferences>.+?)(?:\|(?<artistDisplayText>.+))?:<\/i>(?: \((?<annotation>(?:.*?(?=,|\)$))*?)(?:,? ?(?<date>[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}))?\))?$/gm;
 
 export function filterAlbumsByCommentary(albums) {
   return albums