From 7a1b8e36b4be5aae117fe79eb07e1fbdaf516b8d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 15 Feb 2024 08:57:31 -0400 Subject: data: validate commentary capitalization w/ non-global regex --- src/data/validators.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/data') diff --git a/src/data/validators.js b/src/data/validators.js index 718e9c57..cb321160 100644 --- a/src/data/validators.js +++ b/src/data/validators.js @@ -5,7 +5,7 @@ import printable_characters from 'printable-characters'; const {strlen} = printable_characters; import {colors, ENABLE_COLOR} from '#cli'; -import {commentaryRegexCaseInsensitive, commentaryRegexCaseSensitive} +import {commentaryRegexCaseInsensitive, commentaryRegexCaseSensitiveOneShot} from '#wiki-data'; import { @@ -333,8 +333,7 @@ export function isCommentary(commentaryText) { `(Check for missing "|-" in YAML, or a misshapen annotation)`); } - commentaryRegexCaseSensitive.lastIndex = 0; - if (!commentaryRegexCaseSensitive.test(ownInput)) { + if (!commentaryRegexCaseSensitiveOneShot.test(ownInput)) { throw new TypeError( `Miscapitalization in commentary heading:\n` + `${colors.red(`"${cut(ownInput, 60)}"`)}\n` + -- cgit 1.3.0-6-gf8a5