@Frietjes and Mr. Stradivarius:
This [1] apparently 'fixed' some script errors, but broke the checks. At least, for entries ending with ((-?))
and made Category:Pages with a malformed DYK entry balloon to 160+ 'malformed' entries, which were perfectly well-formed. Headbomb {t · c · p · b} 15:17, 27 November 2020 (UTC)
Live
"((#invoke:Check DYK hook|isValidHook|1=... that director and screenwriter Travis Stevens paused renovations on his production company's house to film '''''[[Girl on the Third Floor]]'''''?))"
= "yes""((#invoke:Check DYK hook|isValidHook|1=... that director and screenwriter Travis Stevens paused renovations on his production company's house to film '''''[[Girl on the Third Floor]]'''''((-?))}"
= "yes"Sandbox
"((#invoke:Check DYK hook/sandbox|isValidHook|1=... that director and screenwriter Travis Stevens paused renovations on his production company's house to film '''''[[Girl on the Third Floor]]'''''?))"
= "yes""((#invoke:Check DYK hook/sandbox|isValidHook|1=... that director and screenwriter Travis Stevens paused renovations on his production company's house to film '''''[[Girl on the Third Floor]]'''''((-?))))"
= "yes"|1=
. Frietjes (talk) 15:26, 27 November 2020 (UTC)
.*?
in the whitespace-trimming pattern, when it should have been .-
. The .*?
is how non-greedy matching works in PCRE regex, but Lua was interpreting that as a greedy match for any character, plus a literal question mark. So hooks that didn't have a literal question mark in (like ones containing ((-?))) didn't match the pattern, meaning the whitespace-trimming code returned nil. Unfortunately, all the test cases that tested the whitespace trimming code contained question marks, so none of them picked this up. I've fixed the problem in the module and added some extra test cases so that this will get caught next time. I've also added a |hook=
parameter, which I thought seemed neater than |1=
for dealing with hooks that might contain an equals sign. — Mr. Stradivarius ♪ talk ♪ 12:42, 29 November 2020 (UTC)