From 1ddf3a57585f30e7bb7ca47623fc061253449ad1 Mon Sep 17 00:00:00 2001 From: Jonathan Harker Date: Mon, 2 Nov 2026 13:22:00 +1300 Subject: [PATCH] emit error if QID is not of the form Q12345 in the right place --- module_citeq.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/module_citeq.lua b/module_citeq.lua index 2c97880..d901bb6 100644 --- a/module_citeq.lua +++ b/module_citeq.lua @@ -569,14 +569,6 @@ local function _cite_q (citeq_args) citeq_args.wdl = nil citeq_args.template = nil - -- QID as normal form; emit error if not ^Q%d+$ (e.g. a Wikidata URL) - local qid_form = mw.ustring.match(mw.text.trim(qid), "^Q%d+$") or nil - if qid_form then - qid = qid_form - else - cq_errors = cq_errors .. ' {{[[Template:Cite Q|Cite Q]]}}: QID parameter must be supplied as "Q" followed by digits, e.g. Q12345 ([[Template:Cite Q#Error messages|help]]) ' - end - -- if title supplied, flag to not read html title local titleforced = (citeq_args.title ~= nil) @@ -1155,6 +1147,12 @@ local function cite_q (frame) args.language = args.language or args.lang args.lang = nil + -- QID as normal form; emit error if not ^Q%d+$ (e.g. a Wikidata URL) + local qid_form = mw.ustring.match(mw.text.trim(args.qid), "^Q%d+$") or nil + if not qid_form then + return ' {{[[Template:Cite Q|Cite Q]]}}: QID parameter must be supplied as "Q" followed by digits, e.g. Q12345 ([[Template:Cite Q#Error messages|help]]) ' + end + local cites = {} for q in args.qid:gmatch("Q%d+") do -- make a new copy of the arguments