Module:UserLinks: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
output user links
(save initial version - user talk links only for the moment)
 
(output user links)
Line 1:
p = {}
 
local toolbarToolbarBuilder = require('Module:Toolbar')
local project, username
 
local function makeUserLink()
return '[[' .. plinkproject .. 'User talk:' .. username .. '|talk' .. username .. ']]'
end
 
local function makeTalkLink()
localreturn plink = (project and (':[[' .. project .. 'User talk:')) or.. username .. '|talk]]'
return '[[' .. plink .. 'User talk:' .. username .. '|talk]]'
end
 
Line 18 ⟶ 21:
local function makeToolbar(args)
local targs = {}
local numArgsExist = false
for k, v in pairs(args) do
if type(k) == 'number' then
numArgsExist = true
targs[k] = getLink(v)
end
Line 25 ⟶ 30:
targs.style = args.small and 'font-size: 90%;'
targs.separator = args.separator or 'dot'
return toolbar.main(targs)
if numArgsExist == false then
return -- Don't return a toolbar if no numeric arguments exist.
else
return toolbarToolbarBuilder.main(targs)
end
end
 
local function getLinks(args)
-- IfGet the username value. If it is absent or blank, return an html error and a tracking category.
if args.user == '' or (not args.user and (not args.User or args.User == '')) then
return '<span class="error">Error: No username detected by [[Module:UserLinks]].</span>[[Category:UserLinks transclusions without usernames]]'
Line 35 ⟶ 45:
username = args.user or args.User
end
-- Get the valuesproject of the other module-wide variablesvalue.
project =if args.Project then
small project = ':' .. args.smallProject .. ':'
else
separator = args.separator
project = ''
end
return makeToolbar(args)
returnlocal result = makeToolbar(args)
if result then
if args.sup then
result = '<sup>' .. result .. '</sup>'
end
result = '&nbsp;' .. result
else
result = ''
end
result = '<span>' .. makeUserLink() .. result .. '</span>'
return result
end
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu