emit error if QID is not of the form Q12345 in the right place
This commit is contained in:
parent
1bd831ae65
commit
1ddf3a5758
1 changed files with 6 additions and 8 deletions
|
|
@ -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 .. ' <span class="error" style="font-size:inherit"><code class="cs1-code">{{[[Template:Cite Q|Cite Q]]}}</code>: QID parameter must be supplied as "Q" followed by digits, e.g. <code class="cs1-code">Q12345</code> ([[Template:Cite Q#Error messages|help]])</span> '
|
||||
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 ' <span class="error" style="font-size:inherit"><code class="cs1-code">{{[[Template:Cite Q|Cite Q]]}}</code>: QID parameter must be supplied as "Q" followed by digits, e.g. <code class="cs1-code">Q12345</code> ([[Template:Cite Q#Error messages|help]])</span> '
|
||||
end
|
||||
|
||||
local cites = {}
|
||||
for q in args.qid:gmatch("Q%d+") do
|
||||
-- make a new copy of the arguments
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue