Module:Check for unknown parameters: Difference between revisions
fix odd bug for | = which gets stripped to nothing, and Category:Foo is broken
m>Magioladitis m (Protected Module:Check for unknown parameters: Highly visible page ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))) |
m>Frietjes (fix odd bug for | = which gets stripped to nothing, and Category:Foo is broken) |
||
Line 46: | Line 46: | ||
if( (not knownflag) and ( (not ignoreblank) or (ignoreblank and isnotempty(v)) ) ) then | if( (not knownflag) and ( (not ignoreblank) or (ignoreblank and isnotempty(v)) ) ) then | ||
k = mw.ustring.gsub(k, '[^%w\-_ ]', '?') | k = mw.ustring.gsub(k, '[^%w\-_ ]', '?') | ||
local r = mw.ustring.gsub(unknown, '_VALUE_', k) | local r = mw.ustring.gsub(unknown, '_VALUE_ ', k) | ||
table.insert(res, r) | table.insert(res, r) | ||
table.insert(comments, '"' .. k .. '"') | table.insert(comments, '"' .. k .. '"') | ||
Line 52: | Line 52: | ||
elseif(checkpos and type(k) == 'number' and knownargs[tostring(k)] == nil) then | elseif(checkpos and type(k) == 'number' and knownargs[tostring(k)] == nil) then | ||
if( (not ignoreblank) or (ignoreblank and isnotempty(v)) ) then | if( (not ignoreblank) or (ignoreblank and isnotempty(v)) ) then | ||
local r = mw.ustring.gsub(unknown, '_VALUE_', k) | local r = mw.ustring.gsub(unknown, '_VALUE_ ', k) | ||
table.insert(res, r) | table.insert(res, r) | ||
table.insert(comments, '"' .. k .. '"') | table.insert(comments, '"' .. k .. '"') |