Module:UserLinks: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(add some different user link functions)
(add block log link)
Line 13: Line 13:
-- u.username The plain username --
-- u.username The plain username --
-- u.usernameHtml The username html-encoded. Spaces are encoded with plus signs. --
-- u.usernameHtml The username html-encoded. Spaces are encoded with plus signs. --
-- u.usernameHtmlWiki The username html-encoded. Spaces are encoded with underscores. --
-- --
-- --
-- u.project The plain project name. --
-- u.project The plain project name. --
Line 43: Line 44:
local function makeLogsLink()
local function makeLogsLink()
return '[[' .. u.projectColon .. 'Special:Log/' .. u.username .. '|logs]]'
return '[[' .. u.projectColon .. 'Special:Log/' .. u.username .. '|logs]]'
end

local function makeBlockLogLink()
local url = mw.uri.fullUrl('Special:Log/block', 'page=User:' .. u.usernameHtmlWiki)
return '[' .. tostring(url) .. ' block log]'
end
end


Line 85: Line 91:
u.username = args.user or args.User
u.username = args.user or args.User
end
end
u.usernameHtml = mw.uri.encode(u.username) -- Html-encoded username
u.usernameHtml = mw.uri.encode(u.username) -- Html-encoded username. Spaces are encoded as pluses.
u.usernameHtmlWiki = mw.uri.encode(u.username, 'WIKI') -- Html-encodeed username. Spaces are encoded as underscores.
-------------------------------------------------
-------------------------------------------------