可在模块:Class/doc创建此模块的帮助文档
local p = {}
local getArgs = require('Module:Arguments').getArgs
local convert = require('Module:NumberToChinese')._numberToChinese
function p.genName(frame)
local args = getArgs(frame)
return p._genName(args)
end
function p._levelLint(level)
level = {}
if level == '高中' or level == '高' or level == 1 then
level[1] = "高中"
level[2] = "高"
return level
else
level[1] = "初中"
level[2] = "初"
return level
end
end
function p._genName(args)
current = require('Module:Date')._current
if current.month >= 9 then
grade = current.year + 1 - args.year
else
grade = current.year - args.year
end
level = p._levelLint(args.level)
if grade > 3 then
return level[1] .. args.year+3 .. '届' .. args.class .. '班' .. args.sub
else
return level[2] .. convert(grade) .. args.class .. '班' .. args.sub
end
end
return p