可在模块:Class/doc创建此模块的帮助文档
local p = {}
local getArgs = require('Module:Arguments').getArgs
local convert = require('Module:NumberToChinese')._numberToChinese
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._levelLint(level)
if level == '高中' or level == '高' or level == 1 then
return '高中', '高'
else
return '初中', '中'
end
end
function p._split(s, delimiter)
result = {};
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
function p._main(args)
current = require('Module:Date')._current
if current.month >= 9 then
grade = args.year + 1 - current.year
else
grade = args.year - current.year
end
if grade > 3 then
return p._split(p._levelLint(args.level), " ")[1] .. args.year+3 .. '届' .. args.class .. '班' .. args.sub
else
return p._split(p._levelLint(args.level), " ")[2] .. convert(args.year) .. args.class .. '班' .. args.sub
end
end
return p