« 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/checks.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/checks.js')
-rw-r--r--src/data/checks.js42
1 files changed, 15 insertions, 27 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index 25863d2d..52024144 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -19,12 +19,6 @@ import {
   withAggregate,
 } from '#aggregate';
 
-import {
-  combineWikiDataArrays,
-  commentaryRegexCaseSensitive,
-  oldStyleLyricsDetectionRegex,
-} from '#wiki-data';
-
 function inspect(value, opts = {}) {
   return nodeInspect(value, {colors: ENABLE_COLOR, ...opts});
 }
@@ -190,7 +184,8 @@ export function filterReferenceErrors(wikiData, {
       groups: 'group',
       artTags: '_artTag',
       referencedArtworks: '_artwork',
-      commentary: '_commentary',
+      commentary: '_content',
+      creditSources: '_content',
     }],
 
     ['artTagData', {
@@ -198,7 +193,8 @@ export function filterReferenceErrors(wikiData, {
     }],
 
     ['flashData', {
-      commentary: '_commentary',
+      commentary: '_content',
+      creditSources: '_content',
     }],
 
     ['groupCategoryData', {
@@ -238,7 +234,9 @@ export function filterReferenceErrors(wikiData, {
       artTags: '_artTag',
       referencedArtworks: '_artwork',
       mainReleaseTrack: '_trackMainReleasesOnly',
-      commentary: '_commentary',
+      commentary: '_content',
+      creditSources: '_content',
+      lyrics: '_content',
     }],
 
     ['wikiInfo', {
@@ -273,12 +271,12 @@ export function filterReferenceErrors(wikiData, {
             let writeProperty = true;
 
             switch (findFnKey) {
-              case '_commentary':
+              case '_content':
                 if (value) {
                   value =
-                    Array.from(value.matchAll(commentaryRegexCaseSensitive))
-                      .map(({groups}) => groups.artistReferences)
-                      .map(text => text.split(',').map(text => text.trim()));
+                    value.map(entry =>
+                      CacheableObject.getUpdateValue(entry, 'artists') ??
+                      []);
                 }
 
                 writeProperty = false;
@@ -334,7 +332,7 @@ export function filterReferenceErrors(wikiData, {
                 findFn = boundFind.artTag;
                 break;
 
-              case '_commentary':
+              case '_content':
                 findFn = findArtistOrAlias;
                 break;
 
@@ -466,7 +464,7 @@ export function filterReferenceErrors(wikiData, {
                 }
               }
 
-              if (findFnKey === '_commentary') {
+              if (findFnKey === '_content') {
                 filter(
                   value, {message: errorMessage},
                   decorateErrorWithIndex(refs =>
@@ -573,7 +571,7 @@ export function reportContentTextErrors(wikiData, {
     annotation: 'commentary annotation',
   };
 
-  const newStyleLyricsShape = {
+  const lyricsShape = {
     body: 'lyrics body',
     artistDisplayText: 'lyrics artist display text',
     annotation: 'lyrics annotation',
@@ -625,7 +623,7 @@ export function reportContentTextErrors(wikiData, {
       additionalFiles: additionalFileShape,
       commentary: commentaryShape,
       creditSources: commentaryShape,
-      lyrics: '_lyrics',
+      lyrics: lyricsShape,
       midiProjectFiles: additionalFileShape,
       sheetMusicFiles: additionalFileShape,
     }],
@@ -749,7 +747,6 @@ export function reportContentTextErrors(wikiData, {
           nest({message: `Content text errors in ${inspect(thing)}`}, ({nest, push}) => {
 
             for (let [property, shape] of Object.entries(propSpec)) {
-              const rawValue = CacheableObject.getUpdateValue(thing, property);
               let value = thing[property];
 
               if (value === undefined) {
@@ -761,15 +758,6 @@ export function reportContentTextErrors(wikiData, {
                 continue;
               }
 
-              if (shape === '_lyrics') {
-                if (oldStyleLyricsDetectionRegex.test(rawValue)) {
-                  value = rawValue;
-                  shape = '_content';
-                } else {
-                  shape = newStyleLyricsShape;
-                }
-              }
-
               const fieldPropertyMessage =
                 getFieldPropertyMessage(
                   thing.constructor[Thing.yamlDocumentSpec],