Pergi ke kandungan

Modul:deprecation error

Daripada Wikikamus


local export = {}

local u = mw.ustring.char

-- This is a massive hack.
local function escape_wikicode(term)
	term = term:gsub("([<'{])", "%1" .. u(0x2060))
	return term
end

function export.show(frame)
	local iparams = {
		[1] = {required = true},
		date = true,
	}
	
	local iargs = require("Module:parameters").process(frame.args, iparams)
	local old_template = frame:getParent():getTitle():gsub("^Templat:", "")
	local as_of = iargs.date and (", as of %s"):format(iargs.date) or ""
	local msg = escape_wikicode(
		("{{%s}} has been deprecated and replaced with {{[[Templat:%s|%s]]}} with equivalent functionality%s. Please use the " ..
		"new template; the old one will be deleted soon."):format(old_template, iargs[1], iargs[1], as_of))
	error(msg)
end

return export