Emit an error if supplied QID is not of the form Q12345
This commit is contained in:
parent
6015a48178
commit
1bd831ae65
1 changed files with 8 additions and 0 deletions
|
|
@ -569,6 +569,14 @@ 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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue