Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Micro Pedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Check for clobbered parameters
Module
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Get shortened URL
Appearance
move to sidebar
hide
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!
local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end function p.check(frame) local args = frame.args local pargs = frame:getParent().args local checknested = isnotempty(args['nested']) local delimiter = isnotempty(args['delimiter']) and args['delimiter'] or ';' local argpairs = {} for k, v in pairs(args) do if type(k) == 'number' then local plist = mw.text.split(v, delimiter) local pfound = {} local count = 0 for ii, vv in ipairs(plist) do vv = trim(vv) if checknested and pargs[vv] or isnotempty(pargs[vv]) then count = count + 1 table.insert(pfound, vv) end end if count > 1 then table.insert(argpairs, pfound) end end end local warnmsg = {} local res = '' local cat = '' if args['cat'] and mw.ustring.match(args['cat'],'^[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]:') then cat = args['cat'] end local template = args['template'] and ' in ' .. args['template'] or '' if #argpairs > 0 then for i, v in ipairs( argpairs ) do table.insert( warnmsg, mw.ustring.format( 'Using more than one of the following parameters%s: <code>%s</code>.', template, table.concat(v, '</code>, <code>') ) ) if cat ~= '' then res = res .. '[[' .. cat .. '|' .. (v[1] == '' and ' ' or '') .. v[1] .. ']]' end end end if #warnmsg > 0 then res = require('Module:If preview')._warning({ table.concat(warnmsg, '<br>') }) .. res end return res end return p
Summary:
Please note that all contributions to Micro Pedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Micro Pedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Check for clobbered parameters/doc
(
edit
)