Module:UserLinks: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(add the rest of the link types, remove wiki-encoded username as I ended up not using it at all) |
(fix bug where the username error wasn't showing up properly, add more comments) |
||
Line 160: | Line 160: | ||
local function generateUserDataStrings(args) |
local function generateUserDataStrings(args) |
||
⚫ | |||
------------------------------------------------- |
|||
⚫ | |||
⚫ | |||
------------------------------------------------- |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
|||
u.usernameHtml = mw.uri.encode(u.username) -- Html-encoded username. Spaces are encoded as pluses. |
u.usernameHtml = mw.uri.encode(u.username) -- Html-encoded username. Spaces are encoded as pluses. |
||
⚫ | |||
⚫ | |||
------------------------------------------------- |
|||
⚫ | |||
------------------------------------------------- |
|||
⚫ | |||
u.projectColon = (u.project and (':' .. args.Project .. ':')) or '' -- Project value plus colons, for escaping interwiki links. |
u.projectColon = (u.project and (':' .. args.Project .. ':')) or '' -- Project value plus colons, for escaping interwiki links. |
||
u.project = u.project or '' -- Control for nil values of args.Project. |
u.project = u.project or '' -- Control for nil values of args.Project. |
||
Line 180: | Line 170: | ||
local function getLinks(args) |
local function getLinks(args) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
-- Generate the user data strings. |
|||
⚫ | |||
-- Build the template output. |
|||
local result = makeToolbar(args) |
local result = makeToolbar(args) -- Get the toolbar contents. |
||
if result then |
if result then |
||
if args.sup then |
if args.sup then |
||
Line 189: | Line 185: | ||
result = ' ' .. result |
result = ' ' .. result |
||
else |
else |
||
result = '' |
result = '' -- If there are no links specified, don't return the toolbar at all. |
||
end |
end |
||
result = '<span>' .. makeUserLink() .. result .. '</span>' |
result = '<span>' .. makeUserLink() .. result .. '</span>' |