918
次編輯
Economy666(留言 | 貢獻) 小無編輯摘要 |
Economy666(留言 | 貢獻) 無編輯摘要 |
||
行 36: | 行 36: | ||
end | end | ||
local function | local cal = mw.loadJsonData 'Template:ComplexArtistsList.json' | ||
local trans = mw.loadJsonData 'Template:Transition.json' | |||
local function link(l, d) | |||
if d then | |||
return '[[' .. l .. '|' .. d .. ']]' | |||
else | |||
return '[[' .. l .. ']]' | |||
end | |||
end | end | ||
local onlyMobile = frame:expandTemplate{title = '仅', args = {'移动版', '', '图片角标'}} | |||
local onlyNS = frame:expandTemplate{title = '仅', args = {'NS版', '', '图片角标'}} | |||
local sectionCode = {unknown = 0, free = 1, archive = 2, mainstory = 3, sidestory = 4, collab = 5, single = 6} | local sectionCode = {unknown = 0, free = 1, archive = 2, mainstory = 3, sidestory = 4, collab = 5, single = 6} | ||
行 93: | 行 103: | ||
data:insert(input '标题' or table.concat({'[[' .. mad.linkTitle(song) .. ']]', unpack(otherTitles(song))}, '<br>')) | data:insert(input '标题' or table.concat({'[[' .. mad.linkTitle(song) .. ']]', unpack(otherTitles(song))}, '<br>')) | ||
local artist = cal[string.gsub(song.artist, ' ' , '') ] | local artist = cal[string.gsub(song.artist, ' ' , '') ] | ||
if not artist then | if not artist then | ||
行 104: | 行 113: | ||
data:insert(input '音乐家' or artist) | data:insert(input '音乐家' or artist) | ||
local | local cc = 'Collaboration %- Collaboration' | ||
local | local ccl = 'Collaboration#Collaboration' | ||
local | local ccd = 'Collaboration' | ||
local | local pack_main = string.gsub(trans.packName[song.set] or packItem['name'], cc, ccl) | ||
local pack_md = string.gsub(pack_main, ccl, ccd) | |||
if mobile_id[id] and ns_id[id] then | if mobile_id[id] and ns_id[id] then | ||
packItem_ns = mad.packQueryWrap(ns_song[id].set, 'ns') | packItem_ns = mad.packQueryWrap(ns_song[id].set, 'ns') | ||
local pack_ns = packItem_ns['name'] | local pack_ns = string.gsub(trans.packName[ns_song[id].set] or packItem_ns['name'], cc, ccl) | ||
local pack_nd = string.gsub(pack_ns, ccl, ccd) | |||
if pack_ns == pack_main then | if pack_ns == pack_main then | ||
pack = link(pack_main) | pack = link(pack_main, pack_md) | ||
else | else | ||
pack = link(pack_main) .. onlyMobile .. '<br \>' ..link(pack_ns) .. onlyNS | pack = link(pack_main, pack_md) .. onlyMobile .. '<br \>' ..link(pack_ns, pack_nd) .. onlyNS | ||
end | end | ||
elseif mobile_id[id] then | elseif mobile_id[id] then | ||
pack = link(pack_main) .. onlyMobile | pack = link(pack_main, pack_md) .. onlyMobile | ||
else | else | ||
pack = link(pack_main) .. onlyNS | pack = link(pack_main, pack_md) .. onlyNS | ||
end | end | ||
次編輯