跳转到内容

模组:Status

被永久保护的模块
维基百科,自由的百科全书

local p = {}
local getArgs = require('Module:Arguments').getArgs

local data = mw.loadData('Module:Status/data')

function p._main(args)
	local arg = args[1] and args[1]:lower() or '處理中'
	local status = data.statusMap[arg] or data.unknownStatus
    local code = args['prefix'] or '狀態:'
    local spanid = nil
    local bot_archive = ''
    if status.keep then
    	spanid = '_new_request'
    	bot_archive = mw.getCurrentFrame():expandTemplate{title='Bot-directive-archiver', args={'keep'}}
    end
    code = code ..  mw.text.tag('span', {
    		['class'] = 't-status',
    		['style'] = 'background:' .. status.color,
    		['id'] = spanid or nil
    		}, '  ')
    code = code .. ' ' .. mw.text.tag('b', {}, args[2] or status.text or args[1] or '處理中') .. (args['sign'] or '')
    code = mw.text.tag('div', {}, code) .. bot_archive
    return code
end

function p.main(frame)
	local args = getArgs(frame, {
		parentFirst = true,
		wrappers = {
			'Template:Status',
		},
	})
    return p._main(args)
end

return p