模組:ACGaward/nominee check
外观
local p = {}
local getArgs = require('Module:Arguments').getArgs
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame)
return p[funcName](args)
end
end
local criteria = {
['1a'] = {'2 kB+新', score = 1},
['1b'] = {'3 kB+新', score = 2},
['1c'] = {'5 kB+新', score = 3},
['1d'] = {'活動條目', score = 3},
['2a'] = {'2 kB+擴', score = 1},
['2b'] = {'3 kB+擴', score = 2},
['2c'] = {'5 kB+擴', score = 3},
['2d'] = {'活動條目', score = 1},
['3'] = {'圖片', score = 1},
['4a'] = {'DYK', score = 1},
['4b'] = {'優良', score = 5},
['4c'] = {'典特', score = 10},
['4d'] = {'特色圖片', score = 5},
['5'] = {'優參', score = 1},
['6'] = {'他薦', score = 1},
}
p.main = makeInvokeFunc('_main')
function p._main(args)
-- 未完成
if args[1] == '0' or args[1] == 'x' then
return "[[File:Red x.svg|13px|alt=紅叉|link=]] '''未完成'''"
end
-- 分割字符串
local items = {}
local _items = mw.text.split(args[1], '[,,、 ]+')
local score = 0
for _, item in ipairs(_items) do
for code, criterion in pairs(criteria) do
if item:find(code) then
table.insert(items, "'''" .. code .. "'''<small>(" .. criterion[1] .. ')</small>')
score = score + criterion.score
break
end
end
end
return table.concat(items, '、') .. ",計'''" .. score .. "'''分"
end
return p