Module:Check for unknown parameters: Difference between revisions

fix substitution of "_VALUE_" when it isn't followed by a space
(fix odd bug for | = which gets stripped to nothing, and Category:Foo is broken)
(fix substitution of "_VALUE_" when it isn't followed by a space)
Line 33:
end
end
end
 
local function addresult(k)
if k == '' then
-- Fix odd bug for | = which gets stripped to the empty string and
-- breaks category links
k = ' '
end
local r = mw.ustring.gsub(unknown, '_VALUE_ ', k)
table.insert(res, r)
table.insert(comments, '"' .. k .. '"')
end
 
Line 46 ⟶ 57:
if( (not knownflag) and ( (not ignoreblank) or (ignoreblank and isnotempty(v)) ) ) then
k = mw.ustring.gsub(k, '[^%w\-_ ]', '?')
addresult(k)
local r = mw.ustring.gsub(unknown, '_VALUE_ ', k)
table.insert(res, r)
table.insert(comments, '"' .. k .. '"')
end
elseif(checkpos and type(k) == 'number' and knownargs[tostring(k)] == nil) then
if( (not ignoreblank) or (ignoreblank and isnotempty(v)) ) then
addresult(k)
local r = mw.ustring.gsub(unknown, '_VALUE_ ', k)
table.insert(res, r)
table.insert(comments, '"' .. k .. '"')
end
end