Module:UserLinks: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(add support for a demo parameter) |
(add function for generating tracking categories, enable lower-case project parameter name) |
||
Line 176: | Line 176: | ||
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. |
||
-- Project helper strings. |
-- Project helper strings. |
||
u.project = args.Project |
u.project = args.Project or args.project |
||
u.projectColon = (u.project and (':' .. |
u.projectColon = (u.project and (':' .. u.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. |
||
end |
|||
local function generateTrackingCategories(args) |
|||
local ret = '' |
|||
if (args.Project or args.project) and not demo then |
|||
ret = ret .. '[[Category:UserLinks transclusions with project parameters]]' |
|||
end |
|||
return ret |
|||
end |
end |
||
Line 186: | Line 194: | ||
return err('no link type specified', 'UserLinks transclusions with invalid link types') |
return err('no link type specified', 'UserLinks transclusions with invalid link types') |
||
end |
end |
||
local result = getLink(linktype) |
|||
result = result .. generateTrackingCategories(args) |
|||
return result |
|||
end |
end |
||
Line 201: | Line 211: | ||
end |
end |
||
result = '<span>' .. makeUserLink() .. result .. '</span>' |
result = '<span>' .. makeUserLink() .. result .. '</span>' |
||
result = result .. generateTrackingCategories(args) |
|||
return result |
return result |