可在模块:Class/doc创建此模块的帮助文档
local p = {}
local getArgs = require('Module:Arguments').getArgs
local convert = require('Module:NumberToChinese')._numberToChinese
function p.genName(frame)
local args = getArgs(frame)
if args.level then
return p._genName(args)
else
return '请输入高中 or 初中'
end
end
function p._levelLint(level)
if level=='高中' or level=='高' then
return {'高中','高'}
else
return {'初中','初'}
end
end
function p._genName(args)
local current = require('Module:Date')._current
local grade
if current.month >= 9 then
grade = current.year + 1 - args.year
else
grade = current.year - args.year
end
local level = p._levelLint(args.level)
if args.status == 'false' then
return level[1] .. args.year .. '级' .. args.class .. '班' .. args.sub
elseif 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