« get me outta code hell

data: matchCommentaryEntries -> matchContentEntries - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-04-14 21:30:38 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-14 21:35:14 -0300
commit76e31544eabbb5f104a8464c1edfaf1e6d884820 (patch)
treecaab7b2753c5890b008550ca031eeeb40fb0cecd
parent63aa6f89824bf59b1fc61a2bdfe75abb372e48f4 (diff)
data: matchCommentaryEntries -> matchContentEntries
-rw-r--r--src/common-util/wiki-data.js8
-rw-r--r--src/data/yaml.js5
2 files changed, 4 insertions, 9 deletions
diff --git a/src/common-util/wiki-data.js b/src/common-util/wiki-data.js
index 8ad51d6a..a4c6b3bd 100644
--- a/src/common-util/wiki-data.js
+++ b/src/common-util/wiki-data.js
@@ -107,14 +107,14 @@ export const commentaryRegexCaseSensitiveOneShot =
 export const multipleLyricsDetectionRegex =
   /^<i>.*:<\/i>/m;
 
-export function matchContentEntries(sourceText, caseSensitiveRegex) {
+export function matchContentEntries(sourceText) {
   const matchEntries = [];
 
   let previousMatchEntry = null;
   let previousEndIndex = null;
 
   for (const {0: matchText, index: startIndex, groups: matchEntry}
-          of sourceText.matchAll(caseSensitiveRegex)) {
+          of sourceText.matchAll(commentaryRegexCaseSensitive)) {
     if (previousMatchEntry) {
       previousMatchEntry.body = sourceText.slice(previousEndIndex, startIndex);
     }
@@ -132,10 +132,6 @@ export function matchContentEntries(sourceText, caseSensitiveRegex) {
   return matchEntries;
 }
 
-export function matchCommentaryEntries(sourceText) {
-  return matchContentEntries(sourceText, commentaryRegexCaseSensitive)
-}
-
 export function filterAlbumsByCommentary(albums) {
   return albums
     .filter((album) => [album, ...album.tracks].some((x) => x.commentary));
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 847489f0..a2c76b45 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -11,8 +11,7 @@ import {colors, ENABLE_COLOR, logInfo, logWarn} from '#cli';
 import {sortByName} from '#sort';
 import Thing from '#thing';
 import thingConstructors from '#things';
-import {matchCommentaryEntries, multipleLyricsDetectionRegex}
-  from '#wiki-data';
+import {matchContentEntries, multipleLyricsDetectionRegex} from '#wiki-data';
 
 import {
   aggregateThrows,
@@ -859,7 +858,7 @@ export function parseContentEntries(thingClass, sourceText, {subdoc}) {
   });
 
   const documents =
-    matchCommentaryEntries(sourceText)
+    matchContentEntries(sourceText)
       .map(matchEntry =>
         withEntries(
           map(matchEntry),