diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-02-26 18:03:58 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-02-26 18:03:58 -0400 |
commit | 7bf9489f14735f9e44af37f2ade14890a119b403 (patch) | |
tree | 8b7742140ceeeda283edfe05f745d0e1a06050fe /src/data/things/validators.js | |
parent | ae5f68ba51bbbe308cc56e70e70209652c869843 (diff) | |
parent | 8d05431f0c815227ba5cd503e88b0ee531c6eeb8 (diff) |
Merge branch 'preview' into image-overlay
Diffstat (limited to 'src/data/things/validators.js')
-rw-r--r-- | src/data/things/validators.js | 13 |
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'); |