Module:Redirect template explained

require('strict')

local p =

-- key is beginning of arg name. value is table with namespace number and link-- alternatively, a function taking the namespace number and returning a validity-- can be usedlocal namespaceCategories =

-- remove whitespaces from beginning and end of argslocal function valueFunc(key, val) if type(val)

'string' then val = val:match('^%s*(.-)%s*$') if val

then return nil end end return valend

local function getPrettyName(args) for k in pairs(namespaceCategories) do if args[k .. ' category'] then return string.format("%s: ", args[k .. ' category'], args.name) end end return string.format("%s: ", args.name)end

function p.main(frame) local args = require('Module:Arguments').getArgs(frame,) local namespace = mw.title.getCurrentTitle.namespace

--- XXX: this is a HORRIBLE HACK. kill it with fire as soon as https://bugzilla.wikimedia.org/show_bug.cgi?id=12974 is fixed local beCompatibleWithBug12974 = args.info and (args.info:find('^[:;#*]', 1)

1 or args.info:find('