local p = {}
function p.main(frame)
local args = frame.args
local rows = {}
local keys = {}
for key, _ in pairs(args) do
if key:match('^时间%d+$') then
local num = key:match('%d+$')
table.insert(keys, tonumber(num))
end
end
table.sort(keys)
for _, num in ipairs(keys) do
local time = args['时间' .. num] or ''
local experience = args['经历' .. num] or ''
local icon = args['图标' .. num] or ''
local name = args['名称' .. num] or ''
local note = args['备注' .. num] or ''
local content
if icon ~= '' then
content = icon
else
if experience == '个人势' or experience == '毕业' or experience == '引退' then
content = experience
else
if name ~= '' then
content = '[[' .. experience .. '|' .. name .. ']]'
else
content = '[[' .. experience .. ']]'
end
end
end
if note ~= '' then
content = content .. ' (' .. note .. ')'
end
local row = string.format(
"|-\n" ..
"| style=\"text-align:left; width:150px;\" | %s\n" ..
"| style=\"text-align:left; padding:0 5px\" | %s",
time, content
)
table.insert(rows, row)
end
return '{| style="font-size:80%;max-width:280px;"\n' ..
table.concat(rows, '\n') ..
'\n|}'
end
return p