« get me outta code hell

wiki-data, yaml: artistless content entries "@@ annotation" - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/common-util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-01-31 17:13:26 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-01-31 17:13:26 -0400
commit3205d96a9095e2419ded46a30ed26b714ad0395f (patch)
treec6bfc2c403b1ae630891486758c48fab4e0375db /src/common-util
parentb45c33241cbb559e493fb19a8e775326d69b3d6f (diff)
wiki-data, yaml: artistless content entries "@@ annotation"
Diffstat (limited to 'src/common-util')
-rw-r--r--src/common-util/wiki-data.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/common-util/wiki-data.js b/src/common-util/wiki-data.js
index e92a80d5..de34a807 100644
--- a/src/common-util/wiki-data.js
+++ b/src/common-util/wiki-data.js
@@ -83,7 +83,16 @@ const dateRegex = groupName =>
   String.raw`)`;
 
 const contentEntryHeadingRegexRaw =
-  String.raw`^<i>(?<artists>.+?):<\/i>(?: \((?<annotation>.*)\))?$`;
+  String.raw`^(?:` +
+    String.raw`(?:` +
+      String.raw`<i>(?<artists>.+?):<\/i>` +
+      String.raw`(?: \((?<annotation1>.*)\))?` +
+    String.raw`)` +
+    String.raw`|` +
+    String.raw`(?:` +
+      String.raw`@@ (?<annotation2>.*)` +
+    String.raw`)` +
+  String.raw`)$`;
 
 const contentEntryHeadingRegex =
   new RegExp(contentEntryHeadingRegexRaw, 'gm');
@@ -121,7 +130,15 @@ export function* matchContentEntries(sourceText) {
       yield workingEntry;
     }
 
-    workingEntry = {...headingMatch.groups};
+    workingEntry = {
+      artists:
+        headingMatch.groups.artists ?? null,
+
+      annotation:
+        headingMatch.groups.annotation1 ??
+        headingMatch.groups.annotation2 ??
+        null,
+    };
 
     if (workingEntry.annotation) {
       const annotationTailMatch =