« get me outta code hell

Merge branch 'preview' of github.com:hsmusic/hsmusic-wiki into preview - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/validators.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-02-26 18:03:20 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-02-26 18:03:20 -0400
commit8d05431f0c815227ba5cd503e88b0ee531c6eeb8 (patch)
tree7acae279d209c20cca1601493548e330317e8646 /src/data/things/validators.js
parent84081cc3b5287f925ffeeb94ae730e4c143b5f59 (diff)
parent2b2f252f246053bd52c36948748a3425d1c950a1 (diff)
Merge branch 'preview' of github.com:hsmusic/hsmusic-wiki into preview
Diffstat (limited to 'src/data/things/validators.js')
-rw-r--r--src/data/things/validators.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js
index 24db3c79..b116120a 100644
--- a/src/data/things/validators.js
+++ b/src/data/things/validators.js
@@ -195,7 +195,18 @@ export function isColor(color) {
 }
 
 export function isCommentary(commentary) {
-  return isString(commentary);
+  isString(commentary);
+
+  const [firstLine] = commentary.match(/.*/);
+  if (!firstLine.replace(/<\/b>/g, '').includes(':</i>')) {
+    throw new TypeError(`Missing commentary citation: "${
+      firstLine.length > 40
+        ? firstLine.slice(0, 40) + '...'
+        : firstLine
+    }"`);
+  }
+
+  return true;
 }
 
 const isArtistRef = validateReference('artist');