Jump to content
Main menu
Main menu
move to sidebar
bumba
Navigation
Mukânda ya ngudi
Mbôngi
Bansoba ya yimpa
Mukânda na bweso
Lusadisu
Balutiti ya speciale
Sosa
Sosa
Kumonana na yandi
Pesa makabu
Sala konte
Kota
Bisadilu na nge mosi
Pesa makabu
Sala konte
Kota
Ba lutiti ya bansoniki yina bo me katula na Internet
learn more
Contributions
Talk
Na kusonika
Module:Check for unknown parameters
Yika bandinga
Module
Disolo
English
Tânga
Soba kisina
Tala bansoba
Bisadilu
Bisadilu
move to sidebar
bumba
Actions
Tânga
Soba kisina
Tala bansoba
General
Mikânda ke sônga awa
Bansoba ya mutindu mosi
Upload file
Lutiti ya bansangu
Sosa URL ya nkufi
Baka nimero ya QR
Kumonana na yandi
move to sidebar
bumba
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- This module may be used to compare the arguments passed to the parent -- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {} local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= '' end function p.check (frame) local args = frame.args local pargs = frame:getParent().args local ignoreblank = isnotempty(frame.args['ignoreblank']) local checkpos = isnotempty(frame.args['checkpositional']) local knownargs = {} local unknown = 'Found _VALUE_, ' local res = {} local comments = {} local commentstr = '' -- create the list of known args, and the return string for k, v in pairs(args) do if type(k) == 'number' then v = mw.ustring.gsub(v, '^%s*(.-)%s*$', '%1') knownargs[v] = 1 else if (k == 'unknown' and type(v) == 'string') then unknown = v end end end -- loop over the parent args, and make sure they are on the list for k,v in pairs(pargs) do if (type(k) == 'string' and knownargs[k] == nil) then if( (not ignoreblank) or (ignoreblank and isnotempty(v)) ) then k = mw.ustring.gsub(k, '[^%w\-_ ]', '?') 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 local r = mw.ustring.gsub(unknown, '_VALUE_', k) table.insert(res, r) table.insert(comments, '"' .. k .. '"') end end end if(#comments > 0) then commentstr = '<!-- Module:Check for unknown parameters results: ' .. table.concat(comments, ', ') .. '-->' end return table.concat(res) .. commentstr end return p
Summary:
By saving changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Katula
Lusadisu ya kusoba
(opens in new window)
Preview page with this template
Wikidata entities used in this page
Module:Check for unknown parameters
: Sitelink, Description: en
Template used on this page:
Module:Check for unknown parameters/doc
(
soba
)
Sosa
Sosa
Na kusonika
Module:Check for unknown parameters
Yika bandinga
Add topic