Jump to content

Module:User:SDZeroBot/Purge list

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SD0001 (talk | contribs) at 13:48, 1 January 2024 (support link update type in second param). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local getArgs = require('Module:Arguments').getArgs
local p = {}

p.entry = function (frame)
	local args = getArgs(frame)
	if not args[1] then
		return '* <span class=error>Missing page name</span>'	
	end
	if args[2] then
		if args[2] == 'forcelinkupdate' then
			args.forcelinkupdate = '1'	
		elseif args[2] == 'forcerecursivelinkupdate' then
			args.forcerecursivelinkupdate = '1'
		end
	end
	local link = args[1]:sub(1, 2) == '[[' and args[1] or ('[[' .. args[1] .. ']]')
	local dayOrDays = args.interval and 
		mw.language.getContentLanguage():plural(tonumber(args.interval), 'day', 'days') or ''
	return '* ' .. link .. 
		(args.interval and ' (every '..args.interval..' '..dayOrDays..')' or '') ..
		(args.forcerecursivelinkupdate and ' <abbr title="with recursive link update">R</abbr>'
			or (args.forcelinkupdate and ' <abbr title="with link update">L</abbr>' or '')
		)
end

return p