Module:Songtable:修订间差异

来自Arcaea中文维基
无编辑摘要
无编辑摘要
 
(未显示10个用户的119个中间版本)
第1行: 第1行:
local p = {}
local getArgs = require('Module:Arguments').getArgs
local link = require('Module:Link')._link
local getData = require("Module:Arcaea Data")
local CL = require('Module:ConvertLink')


function Mergecheck(ta,tb,tc,td)
local aLink= CL.artistLink
--输入4个值,检查合并关系
local pLink= CL.packLink
--输出一个带两个值的table,分别为合并后的块数和一个带有“第几块向右合并几块“的table
local dLink= CL.designerLink
local fullVer= CL.fullVersionNum


local pst=tostring(ta)
local songLength = mw.loadJsonData 'Template:Song Length.json'
local prs=tostring(tb)
local ftr=tostring(tc)
local byd=tostring(td)
local blocksnum=nil --合并后有多少块
local mergenum={1,1,1,1} --在哪块向右合并多少
local result={}


local trun1,trun2,trun3,bydyes=false,false,false,false
local p = {}
if (pst==prs) then trun1=true  end
if (prs==ftr) then trun2=true  end
if (ftr==byd) then trun3=true  end
if (byd~=nil) then bydyes=true end
--trun1 aaxx trun2 xaax trun3 xxaa
--genre1:aaaa genre2:abbb genre3:aaab genre4:aabb
--genre5:aabc genre6:abbc genre7:abcc genre8:abcd
if bydyes then
if trun1    and trun2     and trun3    then blocksnum=1 mergenum[1]=4   end
if not(trun1)  and trun2    and trun3    then blocksnum=2 mergenum[2]=3  end
if trun1    and trun2     and not(trun3) then blocksnum=2 mergenum[1]=3   end
if trun1    and not(trun2)  and trun3    then blocksnum=2 mergenum[1]=2 mergenum[2]=2 end
if trun1    and not(trun2)  and not(trun3)  then blocksnum=3 mergenum[1]=2  end
if not(trun1)  and trun2    and not(trun3)  then blocksnum=3 mergenum[2]=2  end
if not(trun1)  and not(trun2)  and trun3    then blocksnum=3 mergenum[3]=2  end
if not(trun1)  and not(trun2)  and not(trun3) then blocksnum=4          end
else
if trun1  and trun2  then blocksnum=3 mergenum[1]=3 end
if not(trun1) and trun2  then blocksnum=2 mergenum[2]=2 end
if trun1  and not(trun2)  then blocksnum=2 mergenum[1]=2 end
if not(trun1) and not(trun2)  then blocksnum=3        end
end


function timeCov(t)
   return os.date("%Y/%m/%d", t)
end


result[1]=blocksnum
function dateCov(v, d, t, type)
result[2]=mergenum
   if not(v and d) then return nil end
   local box, a, b, c = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
   box:addClass("date-box")
   a:wikitext(t)
   if type == "arg"
     then
     b:wikitext(v..'<br />' .. '('..tostring(d) .. ')')
   else
   local vv, dd = fullVer(v,d)
     b:wikitext('v'..vv..'<br />' .. '('..dd .. ')')
   end
   box:wikitext(tostring(a))
   :wikitext(tostring(b))
   :wikitext(tostring(c))
   return tostring(box)
end


return result
function bgCov(bg)
   if bg == nil
     then
     return nil
   else
     return '[[:分类:采用'..bg..'背景的曲目|'..bg..']]'
   end
end


function choice(a, aKey, b, bKey)
   if aKey then return a end
   if bKey then return b end
   return nil
end
end


function RegularText(text,byd)
function diffMark(diffText, byd, name, inNs, nsByd)
local o=1
   local diff, mark = mw.html.create('div'), mw.html.create('div')
local Secondarybox={}
   diff:wikitext(diffText)
local result=""
   mark:wikitext('仅移动版')
for i=1,11 do
   if byd and inNs and not(nsByd)
Secondarybox[o] =mw.html.create("div")
     then
Secondarybox[o]
     return tostring(tostring(diff)..tostring(mark))
:wikitext(text[o])
   else
:addClass("Sbox"..o)
     return tostring(diff)
if byd==true and (o==1 or o==2) then Secondarybox[o]:cssText("grid-column: 1 / span 5;") end
   end
if o==3 or o==5 or o==7 or o==9 or o==11 then Secondarybox[o]:cssText("grid-column: 1 / span 1;") end
if byd==true and (o==4 or o==6 or o==8 or o==10) then Secondarybox[o]:cssText("grid-column: 2 / span 4;") end
if byd==false and (o==1 or o==2) then Secondarybox[o]:cssText("grid-column: 1 / span 4;") end
if byd==false and (o==4 or o==6 or o==8 or o==10) then Secondarybox[o]:cssText("grid-column: 2 / span 3;") end
result=result..tostring(Secondarybox[o])
o=o+1
end
return result
end
end


function SplitText(text)
function labelText(text, class)
local Mergecheck=Mergecheck(text[1],text[2],text[3],text[4]) --获取合成的转换信息
   local span = mw.html.create('span')
local Secondarybox={}
   span:addClass('label-text')
local result=""
   span:wikitext(text)
   return tostring(span)
for i=1,3 do
local op=1
for i=1,4 do
if text[op]==nil then text[op],text[op+1]=text[op+1],text[op] end
if text[op]==text[op-1] then text[op]=text[op+1] end
op=op+1
end
end
local c,p,o=1,1,12
for i=1,Mergecheck[1] do
local mergenumber=Mergecheck[2][p]
Secondarybox[o] =mw.html.create("div")
Secondarybox[o]
:wikitext(tostring(text[p]))
:addClass("Sbox"..o)
:cssText("grid-column: "..tostring(c+1).." / span "..mergenumber) --第几个块获取第几个块的合成信息
result=result..tostring(Secondarybox[o])
c=c+mergenumber
o=o+1
p=p+1
end
return tostring(result)
end
end


function EasySplitText(ain,byd)
function getImage(id, all, pst, prs, ftr, byd, second, normalJacketArgs, bydJacketArgs, normalJacketData, bydJacketData, bydyes, mold, imageConfig, tab1text, tab2text)
text=ain
-- 谢邀,这写的什么东西我自己都看不懂了 ———Star0
local Secondarybox={}
if not(id or all) then
local result=""
return nil
 
if byd==true
then
local o,p=1,21
for i=1,15 do
Secondarybox[o]=mw.html.create("div")
Secondarybox[o]
:wikitext(tostring(text[o]))
:addClass("Sbox"..p)
result=result..tostring(Secondarybox[o])
o,p=o+1,p+1
end
else
else
local o,p=1,21
local container, tab = mw.html.create('div'), mw.html.create('div')
for i=1,14 do
local tab1, tab2, tab3, part1, part2, part3, jacket1, jacket2
if o~=5 and o~=10
container:addClass('container')
then
tab:attr('id', 'tab-'..mold) tab:addClass('img-tab')
Secondarybox[o]=mw.html.create("div")
local normalJacket, bydJacket
Secondarybox[o]
if normalJacketArgs then
:wikitext(text[o])
if bydJacketArgs then
:addClass("Sbox"..p)
normalJacket, bydJacket = normalJacketArgs, bydJacketArgs
result=result..tostring(Secondarybox[o])
else
normalJacket, bydJacket = normalJacketArgs, normalJacketArgs
end
else
if normalJacketData == "" or normalJacketData == nil then
normalJacket, bydJacket = '未显示', '未显示'
else
normalJacket, bydJacket = link({'画师', tostring(normalJacketData)}), link({'画师', tostring(bydJacketData)})
end
end
o,p=o+1,p+1
end
end
end
Secondarybox[16]=mw.html.create("div")
Secondarybox[16]
:wikitext(text[16])
:addClass("Sbox36")
result=result..tostring(Secondarybox[16])


if bydyes and imageConfig~='nobyd' then
if byd==true
tab1, tab2, part1, part2 = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
then
tab1:wikitext('Normal') tab2:wikitext('Beyond')
tab1:addClass('active img-tab-part normal') tab2:addClass('img-tab-part byd')
if text[18]==nil
tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2))
then
container:wikitext(tostring(tab))
Secondarybox[17]=mw.html.create("div")
 
Secondarybox[17]
if all and byd then
:wikitext(text[17])
part1:wikitext('[[文件:'..all..'|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:'..byd..'|256px|none]]'..labelText('画师')..tostring(bydJacket))
:addClass("Sbox37")
elseif id then
:cssText("grid-column: 2 / span 4;")
part1:wikitext('[[ 文件:Songs '..id..'.jpg|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:Songs '..id..' byd.jpg|256px|none]]'..labelText('画师')..tostring(bydJacket))
result=result..tostring(Secondarybox[17])
end
 
part1:addClass('active tab-text-'..mold) part2:addClass('tab-text-'..mold)
container:wikitext(tostring(part1)) container:wikitext(tostring(part2))
return tostring(container)
 
else
else
Secondarybox[17]=mw.html.create("div")
if pst and prs and ftr then
Secondarybox[17]
tab1, tab2, tab3, part1, part2, part3 = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
:wikitext(text[17])
 
:addClass("Sbox37")
tab1:wikitext('Past') tab2:wikitext('Present') tab3:wikitext('Future')
:cssText("grid-column: 2 / span 3;")
tab1:addClass('img-tab-part pst') tab2:addClass('img-tab-part prs') tab3:addClass('active img-tab-part ftr')
result=result..tostring(Secondarybox[17])
tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2)) tab:wikitext(tostring(tab3))
container:wikitext(tostring(tab))
Secondarybox[18]=mw.html.create("div")
 
Secondarybox[18]
part1:wikitext('[[文件:'..pst..'|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:'..prs..'|256px|none]]'..labelText('画师')..normalJacket) part3:wikitext('[[ 文件:'..ftr..'|256px|none]]'..labelText('画师')..normalJacket)
:wikitext(text[18])
part1:addClass('tab-text-'..mold) part2:addClass('tab-text-'..mold) part3:addClass('active tab-text-'..mold)
:addClass("Sbox38")
container:wikitext(tostring(part1)) container:wikitext(tostring(part2)) container:wikitext(tostring(part3))
result=result..tostring(Secondarybox[18])
return tostring(container)
 
elseif second then
tab1, tab2, part1, part2 = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
tab1:wikitext(tab1text or '第一曲绘') tab2:wikitext(tab2text or '第二曲绘')
tab1:addClass('active img-tab-part normal') tab2:addClass('img-tab-part normal')
tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2))
container:wikitext(tostring(tab))
 
if all then
part1:wikitext('[[文件:'..all..'|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[ 文件:'..second..'|256px|none]]'..labelText('画师')..normalJacket)
else
part1:wikitext('[[文件:'..all..'|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[ 文件:'..second..'|256px|none]]'..labelText('画师')..normalJacket)
end
 
part1:addClass('active tab-text-'..mold) part2:addClass('tab-text-'..mold)
container:wikitext(tostring(part1)) container:wikitext(tostring(part2))
return tostring(container)
 
else
if all then
return '<div>[[文件:'..all..'|256px|none]]'..labelText('画师')..normalJacket..'</div>'
else
return '<div>[[ 文件:Songs '..id..'.jpg|256px|none]]'..labelText('画师')..normalJacket..'</div>'
end
end
end
end
else
Secondarybox[17]=mw.html.create("div")
Secondarybox[17]
:wikitext(text[17])
:addClass("Sbox37")
:cssText("grid-column: 2 / span 3;")
result=result..tostring(Secondarybox[17])
end
end
return tostring(result)
end
end


function autoimage(image)
-- Last判断(未启用)(需要修改)
-- if id == 'last' then
-- tab1, tab2, tab3, part1, part2, part3 = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
-- tab1:wikitext('Normal') tab2:wikitext('Moment') tab3:wikitext('Eternity')
-- tab1:addClass('active img-tab-part ftr') tab2:addClass('img-tab-part byd') tab3:addClass('img-tab-part byd')
-- tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2)) tab:wikitext(tostring(tab3))
-- container:wikitext(tostring(tab))
-- part1:wikitext('[[文件:Songs last.jpg|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:Songs last byd.jpg|256px|none]]'..labelText('画师')..normalJacket) part3:wikitext('[[文件:Songs last byd2.jpg|256px|none]]'..labelText('画师')..normalJacket)
-- part1:addClass('active tab-text-'..mold) part2:addClass('tab-text-'..mold) part3:addClass('tab-text-'..mold)
-- container:wikitext(tostring(part1)) container:wikitext(tostring(part2)) container:wikitext(tostring(part3))
-- return tostring(container)
-- end
 
function merge(list)
   local span = {}
 
   local lastUniqueIndex = nil
   local currentIndex = 1
 
   while currentIndex<=#list do
     if lastUniqueIndex and list[lastUniqueIndex] == list[currentIndex] then
       span[lastUniqueIndex] = span[lastUniqueIndex] + 1
       span[currentIndex] = 0
     else
       lastUniqueIndex = currentIndex
       span[currentIndex] = 1
     end
     currentIndex = currentIndex + 1
   end
 
   local merge = {}
 
   for i = 1, #list do
     if span[i] == 0 then
       merge[i] = 'display:none'
     else
       merge[i] = 'grid-column-start: span '..span[i] .. ';'
     end
   end
 
   return merge
end
 
function title(name,nameSecond,online)
   local result=name
   if nameSecond then result = result .. "<br />" .. nameSecond end
   if not(online) then result = result .. "<br />" .. '此曲目暂未上线' end
   return result
end
 
function p.main(frame)
   local args = getArgs(frame)
   return p._main(args)
end
 
function getCategoryText(category)
   if category=="poprec" then return "流行/推荐" end
   if category=="partner" then return "搭档" end
   if category=="original" then return "原创" end
   if category=="variety" then return "综合" end
   if category=="musicgames" then return "音乐游戏" end
   return nil
end
end


function p.box(frame)
function p._main(args)
-- 函数
   frame=mw.getCurrentFrame()
local RegularGroup={} --不会 进行拆分的组
 
local SplitGroup={} -- 会进行4等拆分
   -- 获取数据查找 函数
local EasySplitGroup={} -- 会进行2 拆分的组
   local data, dataNs
   if args["id"] and args["id"] ~= ""
   then
     data, dataNs = getData.singleSongInformation(args['id'], "id", "mobile"), getData.singleSongInformation(args['id'], "id", "ns")
   elseif args["曲名"]
   then
     data, dataNs = getData.singleSongInformation(args['曲名'], "name", "mobile"), getData.singleSongInformation(args['曲名'], "name", "ns")
   end
 
   -- 判断曲目在哪个平台存在。
   local inMobile,inNs = false, false
   if data("id") or args["更新时间"] then
     inMobile = true
   end
 
   if dataNs("id") or args["更新时间NS"] then
     inNs = true
   end
  
   -- 判断byd谱面是否存在。
   local byd, nsByd
   if args['Beyond等级'] or data('bydRating') then byd = true else byd = false end
   if args['Beyond等级NS'] or dataNs('bydRating') then nsByd = true else nsByd = false end
   -- 判断etr谱面是否存在;先假定NS不会有eternal等级。
   local etr
   if args['Eternal等级'] or data('etrRating') then etr = true else etr = false end
   -- 处理谱师参数,未填写的等级谱师向前级复制(向下兼容)
   local getChartDesigner = {
     {'PastNote编写', 'note编写', 'pstChartDesigner'},
     {'PresentNote编写', 'note编写', 'prsChartDesigner'},
     {'FutureNote编写', 'note编写', 'ftrChartDesigner'},
     {'BeyondNote编写', 'note编写', 'bydChartDesigner'}
   }
   -- 假定 etr 与 byd  不会 同时出现
   if etr then
     getChartDesigner[4]={'EternalNote编写', 'note编写', 'etrChartDesigner'}
   end
 
   local chartDesigner = {}
   for i, k in ipairs(getChartDesigner)
     do
       if args[k[1]] then
         chartDesigner[i] = args[k[1]]
       elseif args[k[2]] then
         chartDesigner[i] = args[k[2]]
       else
         chartDesigner[i] = choice(dLink(tostring(data(k[3])), data('id')), data(k[3]), '', true)
       end
   end
 
   -- 依据byd是否存在处理单元格合并参数。
   local span
   if byd or etr then
     span = merge({chartDesigner[1], chartDesigner[2], chartDesigner[3], chartDesigner[4]})
   else
     span = merge({chartDesigner[1], chartDesigner[2], chartDesigner[3]})
   end
 
   local pstBg = args['Past背景'] or args['背景'] or data('pstBg')
   local prsBg = args['Present背景'] or args['背景'] or data('prsBg')
   local ftrBg = args['Future背景'] or args['背景'] or data('ftrBg')
   local appendBg
   -- 依据byd是否存在处理背景合并参数
   -- 写 硬了点,没和上面一样展开
   if byd then
     appendBg = args['Beyond背景'] or args['背景'] or data('bydBg')
   elseif etr then
   appendBg = args['Eternal背景'] or args['背景'] or data('etrBg')
   end
   local bgSpan = merge({pstBg, prsBg, ftrBg, appendBg})
 
 
   -- if args['曲名'] == 'Tempestissimo' then spanNs = {'grid-column-start: span 1', 'grid-column-start: span 1', 'grid-column-start: span 1', 'grid-column-start: span 1'} end
 
   local imageA = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'],
   args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'a', args['图片显示控制'], args['第一曲绘说明'], args['第二曲绘说明'])
   local imageB = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'],
   args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'b', args['图片显示控制'], args['第一曲绘说明'], args['第二曲绘说明'])
 
   local pstRating = args['Past等级'] or data('pstRating')
   local prsRating = args['Present等级'] or data('prsRating')
   local ftrRating = args['Future等级'] or data('ftrRating')
   local bydRating = args['Beyond等级'] or data('bydRating')
   local etrRating = args['Eternal 级'] or data('etrRating')
 
   local additionalDiffMark
   local additionalDiffMarkClass='byd-label'
   if byd then
     additionalDiffMark = diffMark('[Beyond]', byd, args['曲名'], inNs, nsByd)
     additionalDiffMarkClass='byd-label'
   elseif etr then
     additionalDiffMark = diffMark('[Eternal]', etr, args['曲名'], inNs, false)
     additionalDiffMarkClass='etr-label'
   end
 
   local setText=args['曲包MO'] or choice(pLink(tostring(getData.packName(data('set')))),data('set'),nil)
   local nsSetText=args['曲包NS'] or choice(pLink(tostring(getData.packName(dataNs('set'))),nil,1),dataNs('set'),nil)
   local categoryText=args['类别'] or getCategoryText(data('category'))
 
   local setDisplayText=tostring(setText)
   if setText then
     if categoryText then
       setDisplayText=setDisplayText.." - "..categoryText
     end
     if nsSetText and setText~=nsSetText then
       setDisplayText=setDisplayText..frame:expandTemplate{ title = "仅", args = {"移动版","","图片角标"} }.."<br />"..tostring(nsSetText)..frame:expandTemplate{ title = "仅", args = {"NS版","","图片角标"} }
     end
   else
     setDisplayText=nsSetText
   end
local bydyes
local _v, _d = fullVer(data('version'), tonumber(data('date')))
local column=""
local ver = args[' 更新版本'] or 'v'.._v
local byd=tonumber(frame:getParent().args["Beyond等级"])
local verDate = args[' 更新时间'] or _d
if byd then bydyes=true else bydyes=false end
if bydyes==true then column="10% 22.5% 22.5% 22.5% 22.5%" else column="10% 30% 30% 30%" end
local songname=frame:getParent().args["曲名"]
if frame:getParent().args["第二曲名"] then songname=songname..frame:getParent().args["第二曲名"] end
-- 1-11对应表 example: image class:Sbox1
RegularGroup[1]="image"
RegularGroup[2]=songname
RegularGroup[3]="编曲"
RegularGroup[4]=frame:getParent().args["编曲"]
RegularGroup[5]="曲包"
RegularGroup[6]=frame:getParent().args["曲包"]
RegularGroup[7]="时长"
RegularGroup[8]=frame:getParent().args["时长"]
RegularGroup[9]="BPM"
RegularGroup[10]=frame:getParent().args["BPM"]
RegularGroup[11]="谱师"
local notewrite=frame:getParent().args["Note编写"] --临时转换
if notewrite~=nil then SplitGroup[1],SplitGroup[2],SplitGroup[3],SplitGroup[4]=notewrite,notewrite,notewrite,notewrite end
--如果没有分难度谱师参数输入,直接用谱师的值
-- 12-14 四谱师 如空留位
SplitGroup[1]=frame:getParent().args["PastNote编写"]
SplitGroup[2]=frame:getParent().args["PresentNote编写"]
SplitGroup[3]=frame:getParent().args["FutureNote编写"]
SplitGroup[4]=frame:getParent().args["BeyondNote编写"]
--依次对应21-33
EasySplitGroup[1]="难度"
EasySplitGroup[2]="Past"
EasySplitGroup[3]="Present"
EasySplitGroup[4]="Future"
EasySplitGroup[5]="Beyond"
EasySplitGroup[6]="等级"
EasySplitGroup[7]=frame:getParent().args["Past等级"]
EasySplitGroup[8]=frame:getParent().args["Present等级"]
EasySplitGroup[9]=frame:getParent().args["Future等级"]
EasySplitGroup[10]=frame:getParent().args["Beyond等级"]
EasySplitGroup[11]="物量"
EasySplitGroup[12]=frame:getParent().args["PastNote"]
EasySplitGroup[13]=frame:getParent().args["PresentNote"]
EasySplitGroup[14]=frame:getParent().args["FutureNote"]
EasySplitGroup[15]=frame:getParent().args["BeyondNote"]
EasySplitGroup[16]="画师"
EasySplitGroup[17]=frame:getParent().args["画师"]
EasySplitGroup[18]=frame:getParent().args["Beyond画师"]
EasySplitGroup[19]="更新时间"
EasySplitGroup[20]=frame:getParent().args[" 更新版本"]
EasySplitGroup[21]=frame:getParent().args["Beyond更新版本"]
EasySplitGroup[22]=frame:getParent().args["更新时间"]
EasySplitGroup[23]=frame:getParent().args["Beyond 更新时间"]
   local length = args['时长'] or songLength.normal[data("id") or dataNs("id")]
   -- 生成Grid表格的信息表;在后文中依据格式进行生成。
   local infoList = {
     { title(args['曲名'] or data('title') or dataNs('title'), args['第二曲名'], data('id') or dataNs('id') or #args > 1), { id = 'title'}},
     { imageA or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')), { id = 'top-image'}},
     { imageB or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')), { id = 'right-image'}},
     { '曲目信息', {class = 'header'} },
     { '曲师', { class = 'label'}},
     { args['曲师'] or args['编曲'] or choice(aLink(tostring(data('artist'))) or aLink(tostring(dataNs('artist'))), data('artist') or dataNs('artist'), '', true), { class = 'data'}},
     { '曲包', { class = 'label'}},
     { args['曲包'] or setDisplayText, { class = 'data'}},
     { '时长', { class = 'label'}},
     { length or '-:--', { class = 'data'}},
     { 'BPM', { class = 'label'}},
     { args['BPM'] or data('bpm') or dataNs('bpm'), { class = 'data'}},
     { '谱面信息', { class = 'header'}},
     { '难度', { class = 'label'}},
     { '[Past]', { class = 'pst-label'}},
     { '[Present]', { class = 'prs-label'}},
     { '[Future]', { class = 'ftr-label'}},
     { additionalDiffMark, { class = additionalDiffMarkClass}},
     { '等级', { class = 'label'}},
     { pstRating, { class = 'pst-data'}},
     { prsRating, { class = 'prs-data'}},
     { ftrRating, { class = 'ftr-data'}},
     { bydRating or etrRating, { class = 'byd-data'}},
     { 'note数量', { class = 'label'}},
     { args['PastNote'] or '空', { class = 'pst-data'}},
     { args['PresentNote'] or '空', { class = 'prs-data'}},
     { args['FutureNote'] or '空', {class = 'ftr-data'}},
     { args['BeyondNote'] or args['EternalNote'] or '空', { class = 'byd-data'}},
     { '谱面设计', { class = 'label'}},
     { chartDesigner[1] or '空', { class = 'pst-data'}, span[1]},
     { chartDesigner[2] or '空', { class = 'prs-data'}, span[2]},
     { chartDesigner[3] or '空', { class = 'ftr-data'}, span[3]},
     { chartDesigner[4] or '空', { class = 'byd-data'}, span[4]},
     { '谱面信息(Joy-Con)', { class = 'header ns', id = 'ns-play-header'}},
     { '难度', { class = 'label ns'}},
     { '[Past]', { class = 'pst-label ns'}},
     { '[Present]', { class = 'prs-label ns'}},
     { '[Future]', { class = 'ftr-label ns'}},
     { additionalDiffMark, { class = additionalDiffMarkClass..' ns'}},
     { 'note数量', { class = 'label ns'}},
     { args['PastNoteNS'] or args['PastNote'], { class = 'pst-data ns'}},
     { args['PresentNoteNS'] or args['PresentNote'], { class = 'prs-data ns'}},
     { args['FutureNoteNS'] or args['FutureNote'], { class = 'ftr-data ns'}},
     { args['BeyondNoteNS'] or '空', { class = 'byd-data ns'}},
     { '背景', { class = 'label'}},
     { bgCov(pstBg), { class = 'pst-data'}, bgSpan[1]},
     { bgCov(prsBg), { class = 'prs-data'}, bgSpan[2]},
     { bgCov(ftrBg), { class = 'ftr-data'}, bgSpan[3]},
     { bgCov(appendBg), { class = 'byd-data'}, bgSpan[4]},
     -- { bgCov(args['背景']) or bgCov(data('bg')) or bgCov(dataNs('bg')), { class = 'data' , id = 'bg-normal' }},
     -- { bgCov(args['Future背景']) , { class = 'data' , id = 'bg-ftr' }},
     { '更新时间', { id = 'update-data-label', class = 'label'}},
     { dateCov(ver, verDate, labelText('移动版'), 'arg'), { id = 'mobile-date-normal', class = 'data'}},
     { dateCov(args['Beyond更新版本'], args['Beyond更新时间'], labelText('移动版'), 'arg')
     or dateCov(args['Eternal更新版本'], args['Eternal更新时间'], labelText('移动版'), 'arg')
     or (data('bydVersion') and dateCov(data('bydVersion'), tonumber(data('bydDate')), labelText('移动版'), 'data'))
     or (data('etrVersion') and dateCov(data('etrVersion'), tonumber(data('etrDate')), labelText('移动版'), 'data'))
     or '空', { id = 'mobile-date-byd', class = 'data'}},
     { dateCov(args['更新版本NS'], args['更新时间NS'], labelText('NS版'), 'arg') or dateCov(dataNs('version'), tonumber(dataNs('date')), labelText('NS版'), 'data'), { id = 'ns-date-normal', class = 'data ns'}},
     { '空', { id = 'ns-date-byd', class = 'data ns'}}
   }
   local box = mw.html.create('div')
   -- 样式控制
   box:addClass("arcaeabox")
   -- 假定 etr 与 byd 不会同时出现,etr 暂时复用 byd 的逻辑
   if byd or etr then box:addClass("byd") end
if args['侧'] == '0' or data('side') == 0 or dataNs('side') == 0 then
box:addClass("light")
elseif data('side') == 1 or dataNs('side') == 1 or args['侧'] == '1' then
box:addClass("conflict")
elseif data('side') == 2 or dataNs('side') == 2 or args['侧'] == '2' then
box:addClass("colorless")
else
box:addClass("lephon")
end
   if args['更新版本NS'] or dataNs('id')
     then
     box:addClass("ns-box")
     if not(dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange') or dataNs('bydChange')) -- byd单独分栏禁用(但Infinite Strife,需要)
       then
       box:addClass("ns-same")
     end
   end
   -- 假定 etr 与 byd 不会同时出现,etr 暂时复用 byd 的逻辑
   if (args['Beyond更新版本'] and args['Beyond更新时间']) or (args['Eternal更新版本'] and args['Eternal更新时间'])
   or data('bydVersion') or data('etrVersion') then box:addClass('mobile-byd-date') end
   if nsByd then box:addClass('ns-byd-date') box:addClass('ns-date-span') end
   if not(args['更新版本'] or args['更新时间'] or data('id')) then box:addClass('no-mobile') end
   -- 弃用这种class控制: if args['Future背景'] then box:addClass('bg-ftr') end
   -- 分类添加
   local category = ''
   if args['更新版本NS'] or dataNs('id')
     then
     if args['更新版本'] or args['更新时间'] or data('id')
       then
       category = category..'[[分类:双平台曲目]]'
     else
       category = category..'[[分类:NS版曲目]]'
     end
   else
     category = category..'[[分类:移动版曲目]]'
   end
   if dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange') or dataNs('bydChange') then category = category..'[[分类:多模式谱面有差异的曲目]]' end
   if not(data('id') or dataNs('id') or #args > 1) then category = category..'[[分类:未登陆的曲目]]' end
   if (data('id') or dataNs('id')) and not(args['unset'])
     then
    
     -- 如果没有更新packlist,不自动进行分类。
     if choice(getData.packName(data('set')), data('set'), getData.packName(dataNs('set')), dataNs('set'))
       then
       category = category..'[[分类:'..tostring(choice(getData.packName(data('set')), data('set'), getData.packName(dataNs('set')), dataNs('set'))) .. '曲包曲目]]'
     end
if args['侧'] == '0' or data('side') == 0 or dataNs('side') == 0
then
category = category..'[[分类:光芒侧曲目]]'
elseif args['侧'] == '1' or data('side') == 1 or dataNs('side') == 1
then
category = category..'[[分类:纷争侧曲目]]'
elseif args['侧'] == '2' or data('side') == 2 or dataNs('side') == 2
then
category = category..'[[分类:消色侧曲目]]'
elseif args['侧'] == '3' or data('side') == 3 or dataNs('side') == 3
then
category = category..'[[分类:Lephon侧曲目]]'
else
category = category..'[[分类:未知侧曲目]]'
end
if pstRating then
     category = category..'[[分类:PST'..pstRating .. '级曲目]]'
end
   if prsRating then
     category = category..'[[分类:PRS'..prsRating .. '级曲目]]'
   end
   if ftrRating then
     category = category..'[[分类:FTR'..ftrRating .. '级曲目]]'
     end
     if byd and bydRating then category = category..'[[分类:BYD'..bydRating .. '级曲目]]' end
     if etr and etrRating then category = category..'[[分类:ETR'..etrRating .. '级曲目]]' end
     local bgCatDefault = args['背景'] or data('bg') or dataNs('bg')
     category = category..'[[分类:采用'..bgCatDefault .. '背景的曲目]]'
    
     if((args['Past背景'] or data('pstBg')) ~= bgCatDefault)
     then
       category = category..'[[分类:采用'..(args['Past背景'] or data('pstBg')) .. '背景的曲目]]'
     end
     if((args['Present背景'] or data('prsBg')) ~= bgCatDefault)
     then
       category = category..'[[分类:采用'..(args['Present背景'] or data('prsBg')) .. '背景的曲目]]'
     end
     if((args['Future背景'] or data('ftrBg')) ~= bgCatDefault)
     then
       category = category..'[[分类:采用'..(args['Future背景'] or data('ftrBg')) .. '背景的曲目]]'
     end
     if((args['Beyond背景'] or data('bydBg')) ~= bgCatDefault)
     then
       category = category..'[[分类:采用'..(args['Beyond背景'] or data('bydBg')) .. '背景的曲目]]'
     end
     if((args['Eternal背景'] or data('etrBg')) ~= bgCatDefault)
     then
       category = category..'[[分类:采用'..(args['Eternal背景'] or data('etrBg')) .. '背景的曲目]]'
     end
    
     if ver then category = category..'[[分类:'..string.gsub(ver,'v', 'V') .. '添加的曲目]]' end
     if args['更新版本NS'] then category = category..'[[分类:NS '..string.gsub(args['更新版本NS'],'v', 'V') .. '添加的曲目]]' end
   end
   -- 表格生成
   local boxList = {}
   for _, v  in ipairs(infoList) do
     box:tag('div'):attr(v[2]):cssText(v[3]):wikitext(v[1]):done()
   end
   -- 提示信息
   local noticeText = ''
   if not(data('id') or dataNs('id'))
     then
     noticeText = noticeText..'<li>在Songlist中无法检查到此曲目。请尝试更新[[模板:Songlist]],检查页面名或填写正确的<code>曲名</code>参数。</li>'
   end
   if not(choice(getData.packName(data('set')), data('set'), getData.packName(dataNs('set')), dataNs('set')))
     then
     noticeText = noticeText..'<li>未更新Packlist。曲目信息模板无法进行曲包分类。</li>'
   end
   local noticeTextNote = ''
   if not(args['PastNote']) then noticeTextNote = noticeTextNote..'<code>PastNote</code>' end
   if not(args['PresentNote']) then noticeTextNote = noticeTextNote..'<code>PresentNote</code>' end
   if not(args['FutureNote']) then noticeTextNote = noticeTextNote..'<code>FutureNote</code>' end
   if noticeTextNote ~= ''
     then
     noticeText = noticeText..'<li>此模板缺少'..noticeTextNote..'参数,此参数无法自动读取。</li>'
   end
   if not(length)
     then
     noticeText = noticeText..'<li>此模板缺少<code>时长</code>参数,请在[[Template:Song Length.json]]补充。</li>'
   end
   -- if not(args['更新版本']) and data('id')
     -- then
     -- noticeText = noticeText..'<li>此模板的移动版更新版本是未完整状态。请添加<code>更新版本</code>与<code>更新时间</code>参数。</li>'
   -- end
   if not(args['更新版本NS']) and dataNs('id')
     then
     noticeText = noticeText..'<li>此模板的NS版更新版本是未完整状态。请添加<code>更新版本NS</code>与<code>更新时间NS</code>参数。</li>'
   end
   -- noticeText = noticeText..'<li>调试信息:'..mw.dumpObject(nil)..'</li>'
   local notice
   if noticeText ~= ''
     then
     notice = frame:expandTemplate {title = 'Collapse', args = { ['标题'] = '曲目信息模板提示信息', ['状态'] = '折叠',
       ['标题文字方向'] = 'center', ['标题颜色'] = '#dddddd',
       ['内容颜色'] = '#eeeeee', ['内容样式'] = 'width:800px',
     ['style'] = 'display:table;width:200px', ['class'] = 'nomobile',
     ['内容'] = noticeText}}
     category = category..'[[分类:缺少参数的曲目信息模板]]'
   end
   if args['nocat'] then category = '' end


local texta,textb,textc="","",""
   return tostring(box)..choice(notice, notice, '', true)..category
texta=RegularText(RegularGroup,bydyes)
textb=SplitText(SplitGroup)
textc=EasySplitText(EasySplitGroup,bydyes)
--将参数封装为table变量,输入进函数返回转换后的字符串。
local endstring=texta..textb..textc
local box =mw.html.create("div")
box
:addClass("box")
:cssText("grid-template-columns:"..tostring(column))
:wikitext(endstring)
return tostring(box)
end
end


return p
return p

2024年11月23日 (六) 22:37的最新版本

可在Module:Songtable/doc创建此模块的帮助文档

local getArgs = require('Module:Arguments').getArgs
local link = require('Module:Link')._link
local getData = require("Module:Arcaea Data")
local CL = require('Module:ConvertLink')

local aLink= CL.artistLink
local pLink= CL.packLink
local dLink= CL.designerLink
local fullVer= CL.fullVersionNum

local songLength = mw.loadJsonData 'Template:Song Length.json'

local p = {}

function timeCov(t)
    return os.date("%Y/%m/%d", t)
end

function dateCov(v, d, t, type)
    if not(v and d) then return nil end
    local box, a, b, c = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
    box:addClass("date-box")
    a:wikitext(t)
    if type == "arg"
        then
        b:wikitext(v..'<br />' .. '('..tostring(d) .. ')')
    else
    	local vv, dd = fullVer(v,d)
        b:wikitext('v'..vv..'<br />' .. '('..dd .. ')')
    end
    box:wikitext(tostring(a))
    :wikitext(tostring(b))
    :wikitext(tostring(c))
    return tostring(box)
end

function bgCov(bg)
    if bg == nil
        then
        return nil
    else
        return '[[:分类:采用'..bg..'背景的曲目|'..bg..']]'
    end
end

function choice(a, aKey, b, bKey)
    if aKey then return a end
    if bKey then return b end
    return nil
end

function diffMark(diffText, byd, name, inNs, nsByd)
    local diff, mark = mw.html.create('div'), mw.html.create('div')
    diff:wikitext(diffText)
    mark:wikitext('仅移动版')
    if byd and inNs and not(nsByd)
        then
        return tostring(tostring(diff)..tostring(mark))
    else
        return tostring(diff)
    end
end

function labelText(text, class)
    local span = mw.html.create('span')
    span:addClass('label-text')
    span:wikitext(text)
    return tostring(span)
end

function getImage(id, all, pst, prs, ftr, byd, second, normalJacketArgs, bydJacketArgs, normalJacketData, bydJacketData, bydyes, mold, imageConfig, tab1text, tab2text)
	-- 谢邀,这写的什么东西我自己都看不懂了 ———Star0
	if not(id or all) then
		return nil

	else
		local container, tab = mw.html.create('div'), mw.html.create('div')
		local tab1, tab2, tab3, part1, part2, part3, jacket1, jacket2
		container:addClass('container')
		tab:attr('id', 'tab-'..mold) tab:addClass('img-tab')
		local normalJacket, bydJacket
		if normalJacketArgs then
			if bydJacketArgs then
				normalJacket, bydJacket = normalJacketArgs, bydJacketArgs
			else
				normalJacket, bydJacket = normalJacketArgs, normalJacketArgs
			end
		else
			if normalJacketData == "" or normalJacketData == nil then
				normalJacket, bydJacket = '未显示', '未显示'
			else
				normalJacket, bydJacket = link({'画师', tostring(normalJacketData)}), link({'画师', tostring(bydJacketData)})
			end
		end

		if bydyes and imageConfig~='nobyd' then
			tab1, tab2, part1, part2 = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
			tab1:wikitext('Normal') tab2:wikitext('Beyond')
			tab1:addClass('active img-tab-part normal') tab2:addClass('img-tab-part byd')
			tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2))
			container:wikitext(tostring(tab))

			if all and byd then
				part1:wikitext('[[文件:'..all..'|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:'..byd..'|256px|none]]'..labelText('画师')..tostring(bydJacket))
			elseif id then
				part1:wikitext('[[文件:Songs '..id..'.jpg|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:Songs '..id..' byd.jpg|256px|none]]'..labelText('画师')..tostring(bydJacket))
			end

			part1:addClass('active tab-text-'..mold) part2:addClass('tab-text-'..mold)
			container:wikitext(tostring(part1)) container:wikitext(tostring(part2))
			return tostring(container)

		else
			if pst and prs and ftr then
				tab1, tab2, tab3, part1, part2, part3 = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')

				tab1:wikitext('Past') tab2:wikitext('Present') tab3:wikitext('Future')
				tab1:addClass('img-tab-part pst') tab2:addClass('img-tab-part prs') tab3:addClass('active img-tab-part ftr')
				tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2)) tab:wikitext(tostring(tab3))
				container:wikitext(tostring(tab))

				part1:wikitext('[[文件:'..pst..'|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:'..prs..'|256px|none]]'..labelText('画师')..normalJacket) part3:wikitext('[[文件:'..ftr..'|256px|none]]'..labelText('画师')..normalJacket)
				part1:addClass('tab-text-'..mold) part2:addClass('tab-text-'..mold) part3:addClass('active tab-text-'..mold)
				container:wikitext(tostring(part1)) container:wikitext(tostring(part2)) container:wikitext(tostring(part3))
				return tostring(container)

			elseif second then
				tab1, tab2, part1, part2 = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
				tab1:wikitext(tab1text or '第一曲绘') tab2:wikitext(tab2text or '第二曲绘')
				tab1:addClass('active img-tab-part normal') tab2:addClass('img-tab-part normal')
				tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2))
				container:wikitext(tostring(tab))

				if all then
					part1:wikitext('[[文件:'..all..'|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:'..second..'|256px|none]]'..labelText('画师')..normalJacket)
				else
					part1:wikitext('[[文件:'..all..'|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:'..second..'|256px|none]]'..labelText('画师')..normalJacket)
				end

				part1:addClass('active tab-text-'..mold) part2:addClass('tab-text-'..mold)
				container:wikitext(tostring(part1)) container:wikitext(tostring(part2))
				return tostring(container)

			else
				if all then
					return '<div>[[文件:'..all..'|256px|none]]'..labelText('画师')..normalJacket..'</div>'
				else
					return '<div>[[文件:Songs '..id..'.jpg|256px|none]]'..labelText('画师')..normalJacket..'</div>'
				end
			end
		end
	end
end

		-- Last判断(未启用)(需要修改)
		-- if id == 'last' then
			-- tab1, tab2, tab3, part1, part2, part3 = mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div'), mw.html.create('div')
			-- tab1:wikitext('Normal') tab2:wikitext('Moment') tab3:wikitext('Eternity')
			-- tab1:addClass('active img-tab-part ftr') tab2:addClass('img-tab-part byd') tab3:addClass('img-tab-part byd')
			-- tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2)) tab:wikitext(tostring(tab3))
			-- container:wikitext(tostring(tab))
			-- part1:wikitext('[[文件:Songs last.jpg|256px|none]]'..labelText('画师')..normalJacket) part2:wikitext('[[文件:Songs last byd.jpg|256px|none]]'..labelText('画师')..normalJacket) part3:wikitext('[[文件:Songs last byd2.jpg|256px|none]]'..labelText('画师')..normalJacket)
			-- part1:addClass('active tab-text-'..mold) part2:addClass('tab-text-'..mold) part3:addClass('tab-text-'..mold)
			-- container:wikitext(tostring(part1)) container:wikitext(tostring(part2)) container:wikitext(tostring(part3))
			-- return tostring(container)
		-- end

function merge(list)
    local span = {}

    local lastUniqueIndex = nil
    local currentIndex = 1

    while currentIndex<=#list do
        if lastUniqueIndex and list[lastUniqueIndex] == list[currentIndex] then
            span[lastUniqueIndex] = span[lastUniqueIndex] + 1
            span[currentIndex] = 0
        else
            lastUniqueIndex = currentIndex
            span[currentIndex] = 1
        end
        currentIndex = currentIndex + 1
    end

    local merge = {}

    for i = 1, #list do
        if span[i] == 0 then
            merge[i] = 'display:none'
        else
            merge[i] = 'grid-column-start: span '..span[i] .. ';'
        end
    end

    return merge
end

function title(name,nameSecond,online)
    local result=name
    if nameSecond then result = result .. "<br />" .. nameSecond end
    if not(online) then result = result .. "<br />" .. '此曲目暂未上线' end
    return result
end

function p.main(frame)
    local args = getArgs(frame)
    return p._main(args)
end

function getCategoryText(category)
    if category=="poprec" then return "流行/推荐" end
    if category=="partner" then return "搭档" end
    if category=="original" then return "原创" end
    if category=="variety" then return "综合" end
    if category=="musicgames" then return "音乐游戏" end
    return nil
end

function p._main(args)
    frame=mw.getCurrentFrame()

    -- 获取数据查找函数
    local data, dataNs
    if args["id"] and args["id"] ~= ""
    then
        data, dataNs = getData.singleSongInformation(args['id'], "id", "mobile"), getData.singleSongInformation(args['id'], "id", "ns")
    elseif args["曲名"]
    then
        data, dataNs = getData.singleSongInformation(args['曲名'], "name", "mobile"), getData.singleSongInformation(args['曲名'], "name", "ns")
    end

    -- 判断曲目在哪个平台存在。
    local inMobile,inNs = false, false
    if data("id") or args["更新时间"] then
        inMobile = true
    end

    if dataNs("id") or args["更新时间NS"] then
        inNs = true
    end
    
    -- 判断byd谱面是否存在。
    local byd, nsByd
    if args['Beyond等级'] or data('bydRating') then byd = true else byd = false end
    if args['Beyond等级NS'] or dataNs('bydRating') then nsByd = true else nsByd = false end
    -- 判断etr谱面是否存在;先假定NS不会有eternal等级。
    local etr
    if args['Eternal等级'] or data('etrRating') then etr = true else etr = false end
    -- 处理谱师参数,未填写的等级谱师向前级复制(向下兼容)
    local getChartDesigner = {
        {'PastNote编写', 'note编写', 'pstChartDesigner'},
        {'PresentNote编写', 'note编写', 'prsChartDesigner'},
        {'FutureNote编写', 'note编写', 'ftrChartDesigner'},
        {'BeyondNote编写', 'note编写', 'bydChartDesigner'}
    }
    -- 假定 etr 与 byd 不会同时出现
    if etr then
        getChartDesigner[4]={'EternalNote编写', 'note编写', 'etrChartDesigner'}
    end

    local chartDesigner = {}
    for i, k in ipairs(getChartDesigner)
        do
            if args[k[1]] then
                chartDesigner[i] = args[k[1]]
            elseif args[k[2]] then
                chartDesigner[i] = args[k[2]]
            else
                chartDesigner[i] = choice(dLink(tostring(data(k[3])), data('id')), data(k[3]), '', true)
            end
    end

    -- 依据byd是否存在处理单元格合并参数。
    local span
    if byd or etr then
        span = merge({chartDesigner[1], chartDesigner[2], chartDesigner[3], chartDesigner[4]})
    else
        span = merge({chartDesigner[1], chartDesigner[2], chartDesigner[3]})
    end

    local pstBg = args['Past背景'] or args['背景'] or data('pstBg')
    local prsBg = args['Present背景'] or args['背景'] or data('prsBg')
    local ftrBg = args['Future背景'] or args['背景'] or data('ftrBg')
    local appendBg
    -- 依据byd是否存在处理背景合并参数
    -- 写的硬了点,没和上面一样展开
    if byd then
        appendBg = args['Beyond背景'] or args['背景'] or data('bydBg')
    elseif etr then
    	appendBg = args['Eternal背景'] or args['背景'] or data('etrBg')
    end
    local bgSpan = merge({pstBg, prsBg, ftrBg, appendBg})


    -- if args['曲名'] == 'Tempestissimo' then spanNs = {'grid-column-start: span 1', 'grid-column-start: span 1', 'grid-column-start: span 1', 'grid-column-start: span 1'} end

    local imageA = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'], 
    	args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'a', args['图片显示控制'], args['第一曲绘说明'], args['第二曲绘说明'])
    local imageB = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'], 
    	args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'b', args['图片显示控制'], args['第一曲绘说明'], args['第二曲绘说明'])

    local pstRating = args['Past等级'] or data('pstRating')
    local prsRating = args['Present等级'] or data('prsRating')
    local ftrRating = args['Future等级'] or data('ftrRating')
    local bydRating = args['Beyond等级'] or data('bydRating')
    local etrRating = args['Eternal等级'] or data('etrRating')

    local additionalDiffMark
    local additionalDiffMarkClass='byd-label'
    if byd then
        additionalDiffMark = diffMark('[Beyond]', byd, args['曲名'], inNs, nsByd)
        additionalDiffMarkClass='byd-label'
    elseif etr then
        additionalDiffMark = diffMark('[Eternal]', etr, args['曲名'], inNs, false)
        additionalDiffMarkClass='etr-label'
    end

    local setText=args['曲包MO'] or choice(pLink(tostring(getData.packName(data('set')))),data('set'),nil)
    local nsSetText=args['曲包NS'] or choice(pLink(tostring(getData.packName(dataNs('set'))),nil,1),dataNs('set'),nil)
    local categoryText=args['类别'] or getCategoryText(data('category'))

    local setDisplayText=tostring(setText)
    if setText then
        if categoryText then
            setDisplayText=setDisplayText.." - "..categoryText
        end
        if nsSetText and setText~=nsSetText then
            setDisplayText=setDisplayText..frame:expandTemplate{ title = "仅", args = {"移动版","","图片角标"} }.."<br />"..tostring(nsSetText)..frame:expandTemplate{ title = "仅", args = {"NS版","","图片角标"} }
        end
    else
        setDisplayText=nsSetText
    end
	
	local _v, _d = fullVer(data('version'), tonumber(data('date')))
	local ver = args['更新版本'] or 'v'.._v
	local verDate = args['更新时间'] or _d
	
    local length = args['时长'] or songLength.normal[data("id") or dataNs("id")]

    -- 生成Grid表格的信息表;在后文中依据格式进行生成。
    local infoList = {
        { title(args['曲名'] or data('title') or dataNs('title'), args['第二曲名'], data('id') or dataNs('id') or #args > 1), { id = 'title'}},

        { imageA or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')), { id = 'top-image'}},
        { imageB or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')), { id = 'right-image'}},

        { '曲目信息', {class = 'header'} },

        { '曲师', { class = 'label'}},
        { args['曲师'] or args['编曲'] or choice(aLink(tostring(data('artist'))) or aLink(tostring(dataNs('artist'))), data('artist') or dataNs('artist'), '', true), { class = 'data'}},

        { '曲包', { class = 'label'}},
        { args['曲包'] or setDisplayText, { class = 'data'}},

        { '时长', { class = 'label'}},
        { length or '-:--', { class = 'data'}},

        { 'BPM', { class = 'label'}},
        { args['BPM'] or data('bpm') or dataNs('bpm'), { class = 'data'}},

        { '谱面信息', { class = 'header'}},

        { '难度', { class = 'label'}},
        { '[Past]', { class = 'pst-label'}},
        { '[Present]', { class = 'prs-label'}},
        { '[Future]', { class = 'ftr-label'}},
        { additionalDiffMark, { class = additionalDiffMarkClass}},

        { '等级', { class = 'label'}},
        { pstRating, { class = 'pst-data'}},
        { prsRating, { class = 'prs-data'}},
        { ftrRating, { class = 'ftr-data'}},
        { bydRating or etrRating, { class = 'byd-data'}},

        { 'note数量', { class = 'label'}},
        { args['PastNote'] or '空', { class = 'pst-data'}},
        { args['PresentNote'] or '空', { class = 'prs-data'}},
        { args['FutureNote'] or '空', {class = 'ftr-data'}},
        { args['BeyondNote'] or args['EternalNote'] or '空', { class = 'byd-data'}},

        { '谱面设计', { class = 'label'}},
        { chartDesigner[1] or '空', { class = 'pst-data'}, span[1]},
        { chartDesigner[2] or '空', { class = 'prs-data'}, span[2]},
        { chartDesigner[3] or '空', { class = 'ftr-data'}, span[3]},
        { chartDesigner[4] or '空', { class = 'byd-data'}, span[4]},

        { '谱面信息(Joy-Con)', { class = 'header ns', id = 'ns-play-header'}},
        { '难度', { class = 'label ns'}},
        { '[Past]', { class = 'pst-label ns'}},
        { '[Present]', { class = 'prs-label ns'}},
        { '[Future]', { class = 'ftr-label ns'}},
        { additionalDiffMark, { class = additionalDiffMarkClass..' ns'}},

        { 'note数量', { class = 'label ns'}},
        { args['PastNoteNS'] or args['PastNote'], { class = 'pst-data ns'}},
        { args['PresentNoteNS'] or args['PresentNote'], { class = 'prs-data ns'}},
        { args['FutureNoteNS'] or args['FutureNote'], { class = 'ftr-data ns'}},
        { args['BeyondNoteNS'] or '空', { class = 'byd-data ns'}},

        { '背景', { class = 'label'}},
        { bgCov(pstBg), { class = 'pst-data'}, bgSpan[1]},
        { bgCov(prsBg), { class = 'prs-data'}, bgSpan[2]},
        { bgCov(ftrBg), { class = 'ftr-data'}, bgSpan[3]},
        { bgCov(appendBg), { class = 'byd-data'}, bgSpan[4]},
        -- { bgCov(args['背景']) or bgCov(data('bg')) or bgCov(dataNs('bg')), { class = 'data' , id = 'bg-normal' }},
        -- { bgCov(args['Future背景']) , { class = 'data' , id = 'bg-ftr' }},

        { '更新时间', { id = 'update-data-label', class = 'label'}},
        { dateCov(ver, verDate, labelText('移动版'), 'arg'), { id = 'mobile-date-normal', class = 'data'}},
        { dateCov(args['Beyond更新版本'], args['Beyond更新时间'], labelText('移动版'), 'arg') 
        	or dateCov(args['Eternal更新版本'], args['Eternal更新时间'], labelText('移动版'), 'arg') 
        	or (data('bydVersion') and dateCov(data('bydVersion'), tonumber(data('bydDate')), labelText('移动版'), 'data')) 
        	or (data('etrVersion') and dateCov(data('etrVersion'), tonumber(data('etrDate')), labelText('移动版'), 'data')) 
        	or '空', { id = 'mobile-date-byd', class = 'data'}},
        { dateCov(args['更新版本NS'], args['更新时间NS'], labelText('NS版'), 'arg') or dateCov(dataNs('version'), tonumber(dataNs('date')), labelText('NS版'), 'data'), { id = 'ns-date-normal', class = 'data ns'}},
        { '空', { id = 'ns-date-byd', class = 'data ns'}}
    }

    local box = mw.html.create('div')

    -- 样式控制
    box:addClass("arcaeabox")
    -- 假定 etr 与 byd 不会同时出现,etr 暂时复用 byd 的逻辑
    if byd or etr then box:addClass("byd") end
	if args['侧'] == '0' or data('side') == 0 or dataNs('side') == 0 then
		box:addClass("light")
	elseif data('side') == 1 or dataNs('side') == 1 or args['侧'] == '1' then
		box:addClass("conflict")
	elseif data('side') == 2 or dataNs('side') == 2 or args['侧'] == '2' then
		box:addClass("colorless")
	else
		box:addClass("lephon")
	end

    if args['更新版本NS'] or dataNs('id')
        then
        box:addClass("ns-box")
        if not(dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange') or dataNs('bydChange')) -- byd单独分栏禁用(但Infinite Strife,需要)
            then
            box:addClass("ns-same")
        end
    end
    -- 假定 etr 与 byd 不会同时出现,etr 暂时复用 byd 的逻辑
    if (args['Beyond更新版本'] and args['Beyond更新时间']) or (args['Eternal更新版本'] and args['Eternal更新时间']) 
    	or data('bydVersion') or data('etrVersion') then box:addClass('mobile-byd-date') end
    if nsByd then box:addClass('ns-byd-date') box:addClass('ns-date-span') end
    if not(args['更新版本'] or args['更新时间'] or data('id')) then box:addClass('no-mobile') end
    -- 弃用这种class控制: if args['Future背景'] then box:addClass('bg-ftr') end

    -- 分类添加
    local category = ''

    if args['更新版本NS'] or dataNs('id')
        then
        if args['更新版本'] or args['更新时间'] or data('id')
            then
            category = category..'[[分类:双平台曲目]]'
        else
            category = category..'[[分类:NS版曲目]]'
        end
    else
        category = category..'[[分类:移动版曲目]]'
    end

    if dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange') or dataNs('bydChange') then category = category..'[[分类:多模式谱面有差异的曲目]]' end

    if not(data('id') or dataNs('id') or #args > 1) then category = category..'[[分类:未登陆的曲目]]' end

    if (data('id') or dataNs('id')) and not(args['unset'])
        then
        
        -- 如果没有更新packlist,不自动进行分类。
        if choice(getData.packName(data('set')), data('set'), getData.packName(dataNs('set')), dataNs('set'))
            then
            category = category..'[[分类:'..tostring(choice(getData.packName(data('set')), data('set'), getData.packName(dataNs('set')), dataNs('set'))) .. '曲包曲目]]'
        end

		if args['侧'] == '0' or data('side') == 0 or dataNs('side') == 0
			then
			category = category..'[[分类:光芒侧曲目]]'
		elseif args['侧'] == '1' or data('side') == 1 or dataNs('side') == 1
			then
			category = category..'[[分类:纷争侧曲目]]'
		elseif args['侧'] == '2' or data('side') == 2 or dataNs('side') == 2
			then
			category = category..'[[分类:消色侧曲目]]'
		elseif args['侧'] == '3' or data('side') == 3 or dataNs('side') == 3
			then
			category = category..'[[分类:Lephon侧曲目]]'	
		else
			category = category..'[[分类:未知侧曲目]]'
		end

		if pstRating then
        	category = category..'[[分类:PST'..pstRating .. '级曲目]]'
		end
    	if prsRating then
        	category = category..'[[分类:PRS'..prsRating .. '级曲目]]'
    	end
    	if ftrRating then
        	category = category..'[[分类:FTR'..ftrRating .. '级曲目]]'
        end
        if byd and bydRating then category = category..'[[分类:BYD'..bydRating .. '级曲目]]' end
        if etr and etrRating then category = category..'[[分类:ETR'..etrRating .. '级曲目]]' end

        local bgCatDefault = args['背景'] or data('bg') or dataNs('bg')

        category = category..'[[分类:采用'..bgCatDefault .. '背景的曲目]]'
        
        if((args['Past背景'] or data('pstBg')) ~= bgCatDefault)
        then
            category = category..'[[分类:采用'..(args['Past背景'] or data('pstBg')) .. '背景的曲目]]'
        end

        if((args['Present背景'] or data('prsBg')) ~= bgCatDefault)
        then
            category = category..'[[分类:采用'..(args['Present背景'] or data('prsBg')) .. '背景的曲目]]'
        end

        if((args['Future背景'] or data('ftrBg')) ~= bgCatDefault)
        then
            category = category..'[[分类:采用'..(args['Future背景'] or data('ftrBg')) .. '背景的曲目]]'
        end

        if((args['Beyond背景'] or data('bydBg')) ~= bgCatDefault)
        then
            category = category..'[[分类:采用'..(args['Beyond背景'] or data('bydBg')) .. '背景的曲目]]'
        end

        if((args['Eternal背景'] or data('etrBg')) ~= bgCatDefault)
        then
            category = category..'[[分类:采用'..(args['Eternal背景'] or data('etrBg')) .. '背景的曲目]]'
        end
        
        if ver then category = category..'[[分类:'..string.gsub(ver,'v', 'V') .. '添加的曲目]]' end
        if args['更新版本NS'] then category = category..'[[分类:NS '..string.gsub(args['更新版本NS'],'v', 'V') .. '添加的曲目]]' end
    end

    -- 表格生成
    local boxList = {}

    for _, v  in ipairs(infoList) do
        box:tag('div'):attr(v[2]):cssText(v[3]):wikitext(v[1]):done()
    end

    -- 提示信息
    local noticeText = ''

    if not(data('id') or dataNs('id'))
        then
        noticeText = noticeText..'<li>在Songlist中无法检查到此曲目。请尝试更新[[模板:Songlist]],检查页面名或填写正确的<code>曲名</code>参数。</li>'
    end

    if not(choice(getData.packName(data('set')), data('set'), getData.packName(dataNs('set')), dataNs('set')))
        then
        noticeText = noticeText..'<li>未更新Packlist。曲目信息模板无法进行曲包分类。</li>'
    end

    local noticeTextNote = ''

    if not(args['PastNote']) then noticeTextNote = noticeTextNote..'<code>PastNote</code>' end
    if not(args['PresentNote']) then noticeTextNote = noticeTextNote..'<code>PresentNote</code>' end
    if not(args['FutureNote']) then noticeTextNote = noticeTextNote..'<code>FutureNote</code>' end

    if noticeTextNote ~= ''
        then
        noticeText = noticeText..'<li>此模板缺少'..noticeTextNote..'参数,此参数无法自动读取。</li>'
    end

    if not(length)
        then
        noticeText = noticeText..'<li>此模板缺少<code>时长</code>参数,请在[[Template:Song Length.json]]补充。</li>'
    end

    -- if not(args['更新版本']) and data('id')
        -- then
        -- noticeText = noticeText..'<li>此模板的移动版更新版本是未完整状态。请添加<code>更新版本</code>与<code>更新时间</code>参数。</li>'
    -- end

    if not(args['更新版本NS']) and dataNs('id')
        then
        noticeText = noticeText..'<li>此模板的NS版更新版本是未完整状态。请添加<code>更新版本NS</code>与<code>更新时间NS</code>参数。</li>'
    end

    -- noticeText = noticeText..'<li>调试信息:'..mw.dumpObject(nil)..'</li>'

    local notice
    if noticeText ~= ''
        then
        notice = frame:expandTemplate {title = 'Collapse', args = { ['标题'] = '曲目信息模板提示信息', ['状态'] = '折叠',
            ['标题文字方向'] = 'center', ['标题颜色'] = '#dddddd',
            ['内容颜色'] = '#eeeeee', ['内容样式'] = 'width:800px',
        ['style'] = 'display:table;width:200px', ['class'] = 'nomobile',
        ['内容'] = noticeText}}

        category = category..'[[分类:缺少参数的曲目信息模板]]'
    end

    if args['nocat'] then category = '' end

    return tostring(box)..choice(notice, notice, '', true)..category
end

return p