« get me outta code hell

Merge pull request #151 from hsmusic/data-format-cleanup - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/yaml.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-02-26 18:01:52 -0400
committerGitHub <noreply@github.com>2023-02-26 18:01:52 -0400
commit2b2f252f246053bd52c36948748a3425d1c950a1 (patch)
tree38c01f7eb55d45e83ed0fe0055480c9af9e76708 /src/data/yaml.js
parentf36f93b702729f14021746d56b192b25ac3ed1b7 (diff)
parent3b873a6d04f3d317423d1a037536692de808b6fe (diff)
Merge pull request #151 from hsmusic/data-format-cleanup
Data format cleanup
Diffstat (limited to 'src/data/yaml.js')
-rw-r--r--src/data/yaml.js73
1 files changed, 27 insertions, 46 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 9c3a4b88..6350588d 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -186,14 +186,20 @@ export const processAlbumDocument = makeProcessDocument(T.Album, {
 
   propertyFieldMapping: {
     name: 'Album',
-
-    color: 'Color',
     directory: 'Directory',
+    date: 'Date',
+    color: 'Color',
     urls: 'URLs',
 
-    artistContribsByRef: 'Artists',
-    coverArtistContribsByRef: 'Cover Artists',
-    trackCoverArtistContribsByRef: 'Default Track Cover Artists',
+    hasCoverArt: 'Has Cover Art',
+    hasTrackArt: 'Has Track Art',
+    hasTrackNumbers: 'Has Track Numbers',
+    isListedOnHomepage: 'Listed on Homepage',
+    isListedInGalleries: 'Listed in Galleries',
+
+    coverArtDate: 'Cover Art Date',
+    trackArtDate: 'Default Track Cover Art Date',
+    dateAddedToWiki: 'Date Added',
 
     coverArtFileExtension: 'Cover Art File Extension',
     trackCoverArtFileExtension: 'Track Art File Extension',
@@ -207,23 +213,14 @@ export const processAlbumDocument = makeProcessDocument(T.Album, {
     bannerFileExtension: 'Banner File Extension',
     bannerDimensions: 'Banner Dimensions',
 
-    date: 'Date',
-    trackArtDate: 'Default Track Cover Art Date',
-    coverArtDate: 'Cover Art Date',
-    dateAddedToWiki: 'Date Added',
-
-    hasCoverArt: 'Has Cover Art',
-    hasTrackArt: 'Has Track Art',
-    hasTrackNumbers: 'Has Track Numbers',
-    isMajorRelease: 'Major Release',
-    isListedOnHomepage: 'Listed on Homepage',
-    isListedInGalleries: 'Listed in Galleries',
+    commentary: 'Commentary',
+    additionalFiles: 'Additional Files',
 
+    artistContribsByRef: 'Artists',
+    coverArtistContribsByRef: 'Cover Artists',
+    trackCoverArtistContribsByRef: 'Default Track Cover Artists',
     groupsByRef: 'Groups',
     artTagsByRef: 'Art Tags',
-    commentary: 'Commentary',
-
-    additionalFiles: 'Additional Files',
   },
 });
 
@@ -255,44 +252,40 @@ export const processTrackDocument = makeProcessDocument(T.Track, {
 
   propertyFieldMapping: {
     name: 'Track',
-
     directory: 'Directory',
     duration: 'Duration',
     urls: 'URLs',
 
+    dateFirstReleased: 'Date First Released',
     coverArtDate: 'Cover Art Date',
     coverArtFileExtension: 'Cover Art File Extension',
-    dateFirstReleased: 'Date First Released',
     hasCoverArt: 'Has Cover Art',
-    hasURLs: 'Has URLs',
 
+    lyrics: 'Lyrics',
+    commentary: 'Commentary',
+    additionalFiles: 'Additional Files',
+
+    originalReleaseTrackByRef: 'Originally Released As',
     referencedTracksByRef: 'Referenced Tracks',
     sampledTracksByRef: 'Sampled Tracks',
     artistContribsByRef: 'Artists',
     contributorContribsByRef: 'Contributors',
     coverArtistContribsByRef: 'Cover Artists',
     artTagsByRef: 'Art Tags',
-    originalReleaseTrackByRef: 'Originally Released As',
-
-    commentary: 'Commentary',
-    lyrics: 'Lyrics',
-
-    additionalFiles: 'Additional Files',
   },
 });
 
 export const processArtistDocument = makeProcessDocument(T.Artist, {
   propertyFieldMapping: {
     name: 'Artist',
-
     directory: 'Directory',
     urls: 'URLs',
+    contextNotes: 'Context Notes',
+
     hasAvatar: 'Has Avatar',
     avatarFileExtension: 'Avatar File Extension',
 
     aliasNames: 'Aliases',
-
-    contextNotes: 'Context Notes',
   },
 
   ignoredFields: ['Dead URLs'],
@@ -307,15 +300,15 @@ export const processFlashDocument = makeProcessDocument(T.Flash, {
 
   propertyFieldMapping: {
     name: 'Flash',
-
     directory: 'Directory',
     page: 'Page',
+    urls: 'URLs',
+
     date: 'Date',
     coverArtFileExtension: 'Cover Art File Extension',
 
     featuredTracksByRef: 'Featured Tracks',
     contributorContribsByRef: 'Contributors',
-    urls: 'URLs',
   },
 });
 
@@ -375,8 +368,8 @@ export const processStaticPageDocument = makeProcessDocument(T.StaticPage, {
     nameShort: 'Short Name',
     directory: 'Directory',
 
-    content: 'Content',
     stylesheet: 'Style',
+    content: 'Content',
   },
 });
 
@@ -475,18 +468,6 @@ export function parseAdditionalFiles(array) {
   }));
 }
 
-export function parseCommentary(text) {
-  if (text) {
-    const lines = String(text.trim()).split('\n');
-    if (!lines[0].replace(/<\/b>/g, '').includes(':</i>')) {
-      throw new Error(`Missing commentary citation: "${lines[0].slice(0, 40)}..."`);
-    }
-    return text;
-  } else {
-    return null;
-  }
-}
-
 export function parseContributors(contributors) {
   // If this isn't something we can parse, just return it as-is.
   // The Thing object's validators will handle the data error better