local p =
local redirModule = require "Module:Redirect"local redir = redirModule.luaMainlocal isRedir = redirModule.luaIsRedirect
-- Named arguments (optional) |YYYY= and |WW= used, like: function p.main(frame) local year = frame.args.YYYY or os.date("%G") -- Specified year, or else the current year local week = frame.args.WW or os.date("%V") -- Specified week, or else the current week week = tonumber(week) -- Remove zero-padding, if present local title = frame:expandTemplate -- transclude page to get article title return track_redirect(title, 0)end
function track_redirect(title, depth) if depth > 3 then return "Error: Redirect loop." end if not isRedir(title) then return title end
return track_redirect(redir(title) or title, depth + 1)end
return p