« get me outta code hell

wip - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/validators.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-07-25 16:35:02 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-13 22:54:14 -0300
commit48dde4a388fd4c31dd5680f7535419874124e554 (patch)
tree50c0fce8ef19f3bae856e79b1dc92e257e0db4ab /src/validators.js
parentb1ff1444c47f6bd8c532e3a76eb2a5b92ed82a0e (diff)
wip
Diffstat (limited to 'src/validators.js')
-rw-r--r--src/validators.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/validators.js b/src/validators.js
index 9b34cc04..5300d4ad 100644
--- a/src/validators.js
+++ b/src/validators.js
@@ -368,9 +368,28 @@ export const isCommentary =
     caseSensitiveOneShotRegex: commentaryRegexCaseSensitiveOneShot,
   });
 
+export function isOldStyleLyrics(content) {
+  isContentString(content);
+
+  if (/^<i>/m.test(content)) {
+    throw new TypeError(
+      `Expected old-style lyrics block not to include <i> at start of any line`);
+  }
+
   return true;
 }
 
+export const isLyrics =
+  anyOf(
+    isOldStyleLyrics,
+    validateContentEntries({
+      headingPhrase: `lyrics heading`,
+      entryPhrase: `lyrics entry`,
+
+      caseInsensitiveRegex: commentaryRegexCaseInsensitive,
+      caseSensitiveOneShotRegex: commentaryRegexCaseSensitiveOneShot,
+    }));
+
 const isArtistRef = validateReference('artist');
 
 export function validateProperties(spec) {