local getArgs
local _Novel = {["page"]="Novel"}
local _Manga = {["page"]="Manga"}
local _TVAnime = {["page"]="TVAnime"}
local _Movie = {["page"]="Movie"}
local _OVA = {["page"]="OVA"}
local TypeMapper={
['print']={
["novel"] = _Novel
,["serial novel"] = _Novel
,["novel series"] = _Novel
,["light novel"] = {["page"]="Novel",fixedArgs={['輕小說']="是"}}
,["film comic"] = _Manga
,["other"] = _Novel
,["#default"] = _Manga
},
['video']={
['tv']= _TVAnime
,["series"] = _TVAnime
,["tv series"] = _TVAnime
,["tv movie"] = _Movie
,["tv film"] = _Movie
--[[, ["music"]
,["music video"] = 音乐-{zh-cn:视频;zh-tw:錄影帶;zh-hk:短片;}-
,["commercial"]
,["spot"] = 电视广告 ]]
,["movie"] = _Movie
,["film"] = _Movie
,["movie series"] = _Movie
,["film series"] = _Movie
,["oav"] = _OVA
,["ova"] = _OVA
,["oad"] = _OVA
,["ona"] = {["page"]="OVA",fixedArgs={['ONA']="是"}}
,["drama"] = {['page']="TVDrama"}
,["special"] = _Movie
,["live tv film"] = _Movie
,["live video"] = _Movie
,["live movie"] = _Movie
,["live film"] = _Movie
,["#default"] = _TVAnime
}
}
local function _main(frame)
if not getArgs then getArgs = require('Module:Arguments').getArgs end
local moduleArgs = getArgs(frame, {frameOnly = true})
local _type1 = moduleArgs['_type_']
local conf = TypeMapper[_type1]
if not conf then return require("模块:Error").error({"类型指定错误。"}) end
local templateArgs = getArgs(frame, {trim = true})
local _type2 = mw.ustring.lower(templateArgs['type'] or '#default')
local conf2 = conf[_type2]
if not conf2 then return require("模块:Error").error({"类型指定错误。"}) end
local pageName = "Infobox animanga/".. conf2.page
if conf2.fixedArgs then
for k, v in pairs( conf2.fixedArgs ) do
templateArgs[k] = v
end
end
return frame:expandTemplate{ title=pageName , args = templateArgs }
end
return {['main']=_main}