Module:DesignerSong:修订间差异

添加577字节 、​ 2024年7月25日 (星期四)
信息填充
(整理)
(信息填充)
第15行: 第15行:
local queryNS = data.allSongInformation("id", "ns")
local queryNS = data.allSongInformation("id", "ns")
local diffList = {'PST', 'PRS', 'FTR', 'BYD', 'ETR'}
local diffList = {'PST', 'PRS', 'FTR', 'BYD', 'ETR'}
local diffNameList = {PST='Past', PRS='Present', FTR='Future', BYD='Beyond', ETR='Eternal'}
local bydAppend = {[284]='last'}
local bydAppend = {[284]='last'}


第235行: 第236行:
end
end


local frame = mw.getCurrentFrame()
local head = '\n{| class="wikitable" border="1" cellspacing="1" cellpadding="5" style="text-align:center" width="100%"\n'
local function color(diff, text)
return frame:expandTemplate{ title = "color", args = {diff, text} }
end
 
local head = '{| class="wikitable" border="1" cellspacing="1" cellpadding="5" style="text-align:center" width="100%"\n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |曲名 \n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |曲名 \n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |所属曲包 \n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |所属曲包 \n'
head = head .. '! colspan="2" width="40%" style="position:-webkit-sticky;position:sticky;top:0px;" |谱师名义 \n'
head = head .. '! colspan="2" width="40%" style="position:-webkit-sticky;position:sticky;top:0px;" |谱师名义 \n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |备注 \n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |备注 \n'
local function songUnit(songid,text)
if not songDiffDesigner[songid] then return '' end
   local data = songDiffDesigner[songid]
   local name = songTitle(songid)
   local nameBYD = {songTitle(songid,true)}
   table.insert(nameBYD, bydAppendInfo[songid] and songTitle(bydAppendInfo[songid].id))
   local pack = songPack(songid)
   local wikiText = ''
   local rowspanSong = nameBYD and ('|rowspan='.. #data-#nameBYD ..'|') or ('|rowspan='.. #data ..'|')
   local rowspan ='|rowspan='.. #data ..'|'
   wikiText = wikiText .. '|-\n'..rowspanSong ..'[['..name..']]'..'\n'
   wikiText = wikiText .. rowspan ..pack ..'\n'
   local j = 1
   for num, i in ipairs(data) do
   if nameBYD[1] and i[1] == 'BYD' then
   wikiText = wikiText ..'|'..'[['..(nameBYD[1] or '')..']]'..'\n'
   -- j = j + 1
   end
   local diffFormat = '| '..(i[1] and color(i[1], i[1]) or '')
   local designerFormat = i[3] and '||rowspan='.. i[3] ..'|' ..i[2]  or (i[2] and '||'..i[2] or '')
     wikiText = wikiText .. diffFormat ..designerFormat..'\n'
   wikiText = wikiText .. (num == 1 and rowspan .. (text or '')..'\n' or '')
   wikiText = wikiText .. '|-\n'
   end
   return wikiText
end


local ratingSortMemory ={}
local ratingSortMemory ={}
第310行: 第279行:
-- local parentArgs = frame:getParent().args
-- local parentArgs = frame:getParent().args
local Args = frame.args
local Args = frame.args
local function getDescription(title)
return Args[title .. '.description'] or ''
end
local function getText(dasigner, songid)
return Args[dasigner..'.'..songid .. '.text'] or ''
end
local pickList = readList()
local pickList = readList()
local singleList = genList(pickList)
local singleList = genList(pickList)
local wikiText =''
local wikiText =''
local function color(diff,theText)
theText = not theText and diffNameList[diff] or '?'
return frame:expandTemplate{ title = "color", args = {diff, theText} }
end
local function songUnit(songid,text)
if not songDiffDesigner[songid] then return '' end
   local data = songDiffDesigner[songid]
   local name = songTitle(songid)
   local nameBYD = {songTitle(songid,true)}
   table.insert(nameBYD, bydAppendInfo[songid] and songTitle(bydAppendInfo[songid].id))
   local pack = songPack(songid)
   local wikiText = ''
   local rowspanSong = nameBYD and ('|rowspan='.. #data-#nameBYD ..'|') or ('|rowspan='.. #data ..'|')
   local rowspan ='|rowspan='.. #data ..'|'
   wikiText = wikiText .. '|-\n'..rowspanSong ..'[['..name..']]'..'\n'
   wikiText = wikiText .. rowspan ..pack ..'\n'
   local j = 1
   for num, i in ipairs(data) do
   if nameBYD[1] and i[1] == 'BYD' then
   wikiText = wikiText ..'|'..'[['..(nameBYD[1] or '')..']]'..'\n'
   -- j = j + 1
   end
   local diffFormat = '| '..(i[1] and color(i[1]) or '')
   local designerFormat = i[3] and '||rowspan='.. i[3] ..'|' ..i[2]  or (i[2] and '||'..i[2] or '')
     wikiText = wikiText .. diffFormat ..designerFormat..'\n'
   wikiText = wikiText .. (num == 1 and rowspan .. (text or '')..'\n' or '')
   wikiText = wikiText .. '|-\n'
   end
   return wikiText
end
local function cateText(cate, titelStr)
local function cateText(cate, titelStr)
第320行: 第327行:
local songSort = getSongSort(songs)
local songSort = getSongSort(songs)
theText = theText .."\n"..titelStr.. designer..titelStr.."\n"
theText = theText .."\n"..titelStr.. designer..titelStr.."\n"
theText = theText .. getDescription(designer)
theText = theText .. head
theText = theText .. head
for _,data in ipairs(songSort) do
for _,data in ipairs(songSort) do
local songid = data.id
local songid = data.id
theText = theText .. songUnit(songid)
local text = getText(designer, songid)
theText = theText .. songUnit(songid,text)
end
end
theText = theText .. '|}'
theText = theText .. '|}'
end
end
if cate then
if cate then
for _,designer in ipairs(cate) do
for _,designer in ipairs(cate) do
第365行: 第373行:


local commonText = cateText(desiredOrder, '==')
local commonText = cateText(desiredOrder, '==')
 
local rareText = '\n== 已确认的其他谱师名义及相关曲目名单==\n'
local rareTitle = '已确认的其他谱师名义及相关曲目名单'
local rareText = '\n=='.. rareTitle .. '==\n' .. getDescription(rareTitle)
rareText = rareText .. cateText(rare, '===')
rareText = rareText .. cateText(rare, '===')


local uncommonTitle = '未采用常驻谱师名义的曲目名单及所用名义'
local uncommonText = '\n=='.. uncommonTitle .. '==\n' .. getDescription(uncommonTitle)
local endText = cateText(uncommon_end, '===')
local endText = cateText(uncommon_end, '===')
local uncommonText = '\n==未采用常驻谱师名义的曲目名单及所用名义==\n'
uncommonText = uncommonText ..cateText(nil, '===')..endText
uncommonText = uncommonText ..cateText(nil, '===')..endText


1,014

个编辑