Module:Tfd links/sandbox

-- This module implements Template:Tfd links local p = {}

local function urlencode(text) -- Return equivalent of. local function byte(char) return string.format('%%%02X', string.byte(char)) end return text:gsub('[^ %w%-._]', byte):gsub(' ', '+') end

local function fullurllink(t, a, s) return '[https://en.wikipedia.org/w/index.php?title=' .. urlencode(t) .. '&' .. a .. ' ' .. s .. ']' end

function p.main(frame) local args = frame:getParent.args local ns = args.namespace or 'Template' ns = ns:gsub('^%l', string.upper) local tname = mw.getContentLanguage:ucfirst(args['1']) local fname = ns .. ':' .. tname local fullpagename = frame:preprocess('') local sep = ' · ' local res = '' .. '' .. ns .. ':' .. tname .. ' ('	.. 'talk' .. sep	.. 'history' .. sep	.. fullurllink('Special:Whatlinkshere/' .. fname, 'limit=5000&hidelinks=1&hideredirs=1', 'transclusions') .. sep	.. fullurllink('Special:Log', 'page=' .. urlencode(fname), 'logs') .. sep	.. 'subpages) ' return res end

return p