Module:User and Module:User/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
imported>Ahecht
add 3, 4, 6, 7, and 8
 
imported>Pppery
Create sandbox version of Module:User
 
Line 28: Line 28:
end
end


function p.main(frame, opts)
function p.main(frame)
-- Grab the user, project and lang args from wikitext.
-- Grab the user, project and lang args from wikitext.
local argKeys = {
local argKeys = {
Line 47: Line 47:
}
}
}
}
local origArgs = require('Module:Arguments').getArgs(frame)
local origArgs = frame:getParent().args
local args = {}
local args = {}
for argKey, t in pairs(argKeys) do
for argKey, t in pairs(argKeys) do
Line 71: Line 71:
-- Input the codes directly. This saves two argument lookups for each
-- Input the codes directly. This saves two argument lookups for each
-- invocation.
-- invocation.
local codes = type(opts) and opts or {'t', 'c'}
local codes = {'t', 'c'}
-- Generate mop icon for formeradmin
local mop = (origArgs.mop and yesno(origArgs.mop)) and require('Module:Icon')._main({'mop'}) or ''
-- Plug the data into [[Module:UserLinks]].
-- Plug the data into [[Module:UserLinks]].
Line 81: Line 78:
local success, result = pcall(mUserLinks.export, codes, links, options)
local success, result = pcall(mUserLinks.export, codes, links, options)
if success then
if success then
return mop .. result
return result
else
else
return mShared.makeWikitextError(result, options.isDemo)
return mShared.makeWikitextError(result, options.isDemo)
end
end
end
end
function p.admin(frame)
return p.main(frame, {'t','c','bls','pr','del','m','rl','rfa'})
end
function p.eight(frame)
return p.main(frame, {'t', 'c', 'ca', 'ct', 'e'})
end
function p.five(frame)
return p.main(frame, {'t', 'c', 'dc', 'm', 'bu', 'bl'})
end
function p.four(frame)
return p.main(frame, {'t', 'c', 'e'})
end
function p.formeradmin(frame)
return p.main(frame, {'t','c','fa','bls','pr','del','rl','mr','lr'})
end
function p.seven(frame)
return p.main(frame, {'t', 'c', 'ct', 'l', 'e'})
end
function p.six(frame)
return p.main(frame, {'t', 'c', 'ct', 'l', 'm', 'bl'})
end
function p.three(frame)
return p.main(frame, {'t', 'c', 'l'})
end
function p.two(frame)
return p.main(frame, {'t', 'c', 'ct'})
end
p[''] = p.main
p['2'] = p.two
p['3'] = p.three
p['4'] = p.four
p['5'] = p.five
p['6'] = p.six
p['7'] = p.seven
p['8'] = p.eight
p['former admin'] = p.formeradmin


return p
return p