« get me outta code hell

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:
Diffstat (limited to 'src/data')
-rw-r--r--src/data/yaml.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index cde4413b..5da66c93 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -730,11 +730,14 @@ export function parseContributors(contributionStrings) {
     return contributionStrings;
   }
 
-  return contributionStrings.map(contribString => {
-    if (typeof contribString !== 'string') return contribString;
+  return contributionStrings.map(item => {
+    if (typeof item === 'object' && item['Who'])
+      return {who: item['Who'], what: item['What'] ?? null};
 
-    const match = contribString.match(extractAccentRegex);
-    if (!match) return contribString;
+    if (typeof item !== 'string') return item;
+
+    const match = item.match(extractAccentRegex);
+    if (!match) return item;
 
     return {
       who: match.groups.main,
@@ -748,11 +751,14 @@ export function parseAdditionalNames(additionalNameStrings) {
     return additionalNameStrings;
   }
 
-  return additionalNameStrings.map(additionalNameString => {
-    if (typeof additionalNameString !== 'string') return additionalNameString;
+  return additionalNameStrings.map(item => {
+    if (typeof item === 'object' && item['Name'])
+      return {name: item['Name'], annotation: item['Annotation'] ?? null};
+
+    if (typeof item !== 'string') return item;
 
-    const match = additionalNameString.match(extractAccentRegex);
-    if (!match) return additionalNameString;
+    const match = item.match(extractAccentRegex);
+    if (!match) return item;
 
     return {
       name: match.groups.main,