« 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/data
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/data
parentb45c33241cbb559e493fb19a8e775326d69b3d6f (diff)
wiki-data, yaml: artistless content entries "@@ annotation"
Diffstat (limited to 'src/data')
-rw-r--r--src/data/yaml.js78
1 files changed, 40 insertions, 38 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 85c05b93..ddf4481d 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -942,47 +942,49 @@ export function parseContentEntriesFromSourceText(thingClass, sourceText, {subdo
   function map(matchEntry) {
     let artistText = null, artistReferences = null;
 
-    const artistTextNodes =
-      Array.from(
-        splitContentNodesAround(
-          parseContentNodes(matchEntry.artists),
-          /\|/g));
-
-    const separatorIndices =
-      artistTextNodes
-        .filter(node => node.type === 'separator')
-        .map(node => artistTextNodes.indexOf(node));
-
-    if (empty(separatorIndices)) {
-      if (artistTextNodes.length === 1 && artistTextNodes[0].type === 'text') {
-        artistReferences = matchEntry.artists;
+    if (matchEntry.artists) {
+      const artistTextNodes =
+        Array.from(
+          splitContentNodesAround(
+            parseContentNodes(matchEntry.artists),
+            /\|/g));
+
+      const separatorIndices =
+        artistTextNodes
+          .filter(node => node.type === 'separator')
+          .map(node => artistTextNodes.indexOf(node));
+
+      if (empty(separatorIndices)) {
+        if (artistTextNodes.length === 1 && artistTextNodes[0].type === 'text') {
+          artistReferences = matchEntry.artists;
+        } else {
+          artistText = matchEntry.artists;
+        }
       } else {
-        artistText = matchEntry.artists;
+        const firstSeparatorIndex =
+          separatorIndices.at(0);
+
+        const secondSeparatorIndex =
+          separatorIndices.at(1) ??
+          artistTextNodes.length;
+
+        artistReferences =
+          matchEntry.artists.slice(
+            artistTextNodes.at(0).i,
+            artistTextNodes.at(firstSeparatorIndex - 1).iEnd);
+
+        artistText =
+          matchEntry.artists.slice(
+            artistTextNodes.at(firstSeparatorIndex).iEnd,
+            artistTextNodes.at(secondSeparatorIndex - 1).iEnd);
       }
-    } else {
-      const firstSeparatorIndex =
-        separatorIndices.at(0);
-
-      const secondSeparatorIndex =
-        separatorIndices.at(1) ??
-        artistTextNodes.length;
-
-      artistReferences =
-        matchEntry.artists.slice(
-          artistTextNodes.at(0).i,
-          artistTextNodes.at(firstSeparatorIndex - 1).iEnd);
-
-      artistText =
-        matchEntry.artists.slice(
-          artistTextNodes.at(firstSeparatorIndex).iEnd,
-          artistTextNodes.at(secondSeparatorIndex - 1).iEnd);
-    }
 
-    if (artistReferences) {
-      artistReferences =
-        artistReferences
-          .split(',')
-          .map(ref => ref.trim());
+      if (artistReferences) {
+        artistReferences =
+          artistReferences
+            .split(',')
+            .map(ref => ref.trim());
+      }
     }
 
     return {