Module:Deprecation

来自Minecraft基岩版开发Wiki
[创建 | 历史 | 清除缓存]文档页面
此模块没有文档页面。如果你知道如何使用模块,请创建它。
local p = {}

local I18N = {
	Component = '组件',
	Function = '函数',
	Method = '方法',
	Class = '类',
	Field = '字段'
}

local OBJECT = {
	class = 'Class',
	field = 'Field',
	component = 'Component',
	method = 'Method',
	func = 'Function',
	['function'] = 'Function'
}

function p.ambox(_)
	local args = require('Module:ProcessArgs').merge(true)
	local object = args.object
	object = OBJECT[object] or object
	local version = args.version
	local note = args.note or ''
	local issue = "'''"
	local fix = ''
	if (object) then
		issue = issue .. '该' .. (I18N[object] or object)
	else
		issue = issue .. '此处介绍的内容'
	end
	if (version) then
		issue = issue .. '已于' .. version .. '被弃用。'
	else
		issue = issue .. '已被弃用。'
	end
	issue = issue .. "'''<br>"
	local substitute = args.substitute
	if (substitute) then
		fix = '请使用' .. substitute .. '替代。'
	end
	fix = fix .. note
	return require('Module:Message box').ambox({
		name = 'Deprecated ' .. object,
		type = 'speedy',
		issue = issue,
		fix = fix
	})
end

return p