Module:沙盒/盐棋/Sandbox:修订间差异

来自Arcaea中文维基
(unlock)
(expandTemplate)
 
(未显示同一用户的29个中间版本)
第1行: 第1行:
local getArgs = require 'Module:Arguments'.getArgs
-- local link = require 'Module:Link'._link
local mad = require 'Module:AnotherData'
local lang = mw.language.getContentLanguage()
local p = {}
local p = {}
local slstIdx = mw.loadData "Module:沙盒/盐棋/Sandbox1".slstIdx
local unlocks = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate { title = "unlocks" }).unlocks
;(function(u) local _ = u[14]; u[14] = u[16]; u[16] = u[17]; u[17] = u[15]; u[15] = _; table.insert(u, { songId = "" }) end)(unlocks)


p.condition = setmetatable({
local bgLinkF = '[[:分类:采用%s背景的曲目|%s]]'
song_id = function(v) return "[[" .. slstIdx[v].title .. "]]" end,
local bgCatF = '采用%s背景的曲目'
song_difficulty = function(v) return "[" .. ({ [0] = "PST", "PRS", "FTR", "BYD" })[v] .. "]" end,
local function array(...) return setmetatable({...}, {__index = table}) end
grade = function(v) return v == 0 and "" or ("以 「%s」 或以上成绩"):format(({ "C", "B", "A", "AA", "EX" })[v]) end,
local function onlySupScript(s) return mw.getCurrentFrame():expandTemplate {title = '仅', args = {s, '', '图片角标'}} end
rating = function(v) return ("%.2f"):format(v / 100) end,
local function vdValidation(v, d) return v and d and {v, d} end
id = function() return "[[拉格兰]]" end,
local function labelText(text) return mw.html.create 'span':addClass 'bg-c label':wikitext(text) end
[0] = "$credit 残片",
local br = mw.html.create 'br'
"$grade通关 $song_id $song_difficulty",
local function dateCov(dateBox, data, plat)
"游玩 $song_id $song_difficulty",
if not data then return end
"$grade通关 $song_id $song_difficulty$times回",
local version, date = unpack(data)
"$1 <br>''' ''' $2",
dateBox:tag 'div':node(labelText(plat)):node(br):wikitext(version):node(br):wikitext('(', date, ')'):done()
"个人游玩潜力值 $rating 或以上",
end
[103] = "获得搭档「$id」"
local function span(len) if len > 1 then return 'gc-s' .. len end end
}, {
 
__call = function(self, args)
-- .container
return string.gsub(self[args.type] or "", "%$[a-z12_]+", function(k)
-- .img-tab#tab-a
k = k:sub(2)
-- .img-tab-part.{cls} * n
if self[k] then return self[k](args[k]) end
-- {text}
if tonumber(k) then return self(args.conditions[tonumber(k)]) end
-- .tab-text-a.active? * n
return args[k]
-- {file}[ 画师]{jacket}
end)
---@param view table<integer,table<integer,string>>
---@param activeIdx integer?
---@return table
local function createContainer(view, activeIdx)
activeIdx = activeIdx or 1
local container = mw.html.create 'div':addClass 'container'
local tab = container:tag 'div':addClass 'img-tab':attr('id', 'tab-a')
for _, v in ipairs(view) do
local text, cls = v[1], v[2] or 'normal'
tab:tag 'div':wikitext(text):addClass 'img-tab-part':addClass(cls):done()
end
for idx, v in ipairs(view) do
local file, jacket = v[3], v[4]
container
:tag 'div':addClass 'tab-text-a':addClass(idx == activeIdx and 'active' or nil)
:wikitext('[[文件:', file, '|', 256, 'px|none]]')
:node(labelText '画师')
:wikitext(jacket)
:done()
end
return container
end
local function getImage(args, song)
local id = song and song.id
local argPic = args['图片'] or args['曲绘']
local argArtist = args['画师']
if args['Beyond画师'] then
return createContainer {
{'Normal', nil, argPic, argArtist},
{'Beyond', 'byd', args['Beyond曲绘'], args['Beyond画师']},
}
end
return mw.html.create 'div'
:wikitext('[[文件:', id and ('Songs ' .. id .. '.jpg') or argPic, '|', 256, 'px|none]]')
:node(labelText '画师')
:wikitext(argArtist)
end
local function tabCustom(args)
local i = 1
local res = array()
while args['tab' .. i] do
res:insert {mw.ustring.match(args['tab' .. i], '([^/]*)/([^/]*)/([^/]*)/(.*)')}
i = i + 1
end
return res, args['默认图片序号']
end
local function merge(charts, field)
local res = array()
local cur, len = charts[1][field], 1
for _, c in ipairs {}, charts, 1 do
local e = c[field]
if e == cur then
len = len + 1
else
res:insert {cur, len}
cur = e
len = 1
end
end
end
})
res:insert {cur, len}
return res
end
local function getSet(sm, sns)
--% 要求名字相同
local qm, qns = mad.packQueryWrap(sm and sm.set, 'mobile'), mad.packQueryWrap(sns and sns.set, 'ns')
local namem, namens = qm.section ~= 'unknown' and qm.name or nil, qns.section ~= 'unknown' and qns.name or nil
local name = namem or namens
if not name then return nil end
local res = {name}
if namens and namens ~= name then table.insert(res, namens .. onlySupScript 'NS版') end
if #res > 1 then res[1] = res[1] .. onlySupScript '移动版' end
return table.concat(res, '<br>')
end
-- TODO:displaytitle lowercase
local function getById(list, id)
for _, k in ipairs(list) do if k.id == id then return k end end
end
local function getByTitle(list, title)
for _, k in ipairs(list) do if k.title_localized.en == title then return k end end
end
local function auto(args)
local category = {}
local function addCategory(item)
table.insert(category, '[[分类:' .. item .. ']]')
end
local notice = {}


local function unlocksIt(ware)
--% "曲名"必存在,"id"必非空串
local i, key = 1, nil
local songKey, getDatum = args['id'], getById
return function()
if not songKey then songKey, getDatum = mw.text.decode(args['曲名']), getByTitle end
if ware[i].songId == "" then return end
local lm, lns
local arr = {}
if args['愚人节'] then
key = ware[i].songId
lm, lns = mad.listOfReserve(), array()
repeat
elseif songKey == 'Last' then
table.insert(arr, ware[i].ratingClass + 1, ware[i].conditions)
lm, lns = mad.listOfReserve(), mad.listOfReserve()
i = i + 1
else
until ware[i].songId ~= key
lm, lns = mad.listOf('songs', 'mobile'), mad.listOf('songs', 'ns')
if ware[i].songId == "lasteternity" then i = i + 4 end--
end
return key, arr
local sm, sns = getDatum(lm, songKey), getDatum(lns, songKey)
--% 可能平台不一致
local set = args['曲包'] or getSet(sm, sns)
local platCode = (sm and 1 or 0) + (sns and 2 or 0)
local song = sm or sns
if not (sns and sns ~= song) then sns = {difficulties = array()} end
if not song then
notice.data = true
song = mad.listOfReserve()[1]
song.title_localized.en = songKey
end
 
local box = mw.html.create 'div':addClass 'infotable'
local header = box:tag 'div':addClass 'header bg-c fs-l':wikitext(song.title_localized.en)
if song.title_localized.ja then header:node(br):node 'span':attr {lang = 'ja'}:wikitext(song.title_localized.ja) end
if song.title_localized['zh-Hans'] then header:node(br):wikitext(song.title_localized['zh-Hans']) end
box:tag 'div':addClass 'figure central':node(args['tab1'] and createContainer(tabCustom(args)) or getImage(args, song))
--% :create''
local main = box:tag 'div':addClass 'main'
 
addCategory(({'移动版曲目', 'NS版曲目', '双平台曲目'})[platCode])
local sideCode = (tonumber(args['侧']) or song.side) + 1
box:addClass(({'light', 'conflict', 'colorless'})[sideCode])
addCategory(({'光芒侧曲目', '纷争侧曲目', '消色侧曲目'})[sideCode])
local colTags = array()
for idx, diff in ipairs(song.difficulties) do
colTags[idx] = diff['@tag'] or ({[0] = 'Past', 'Present', 'Future', 'Beyond', 'Eternal'})[diff.ratingClass]
end
main:addClass('repeat-' .. #colTags)
 
local artist = args['编曲'] or args['曲师'] or song.artist
if not set then notice.pack = true end
-- addCategory %set曲包曲目
local duration = args['时长']
if not duration then notice.duration = true end
local bpm = args['BPM'] or song.bpm
main:tag 'div':addClass 'gc-1 bg-c fs-m':wikitext '曲目信息'
for _, v in ipairs {{'曲师', artist}, {'曲包', set}, {'时长', duration}, {'BPM', bpm},} do
local tag, data = unpack(v)
main:tag 'div':addClass 'bg-c central':wikitext(tag):done()
:tag 'div':addClass 'gc-2':wikitext(data)
end
end
end


function p.single(id)
local bg = args['背景'] or song.bg
--- unlocks song k/v :
if bg then addCategory(bgCatF:format(bg)) end
for songk, songv in unlocksIt(unlocks) do
local vd = vdValidation(args['更新版本'], args['更新时间'])
if id == songk then return songv end
if not vd then notice.vd = true end
local vdNS
if sns.id then
vdNS = vdValidation(args['更新版本NS'], args['更新时间NS'])
if not vdNS then notice.vd = true end
end
end
end


local detail = {}
local charts = array()
function p.detail(type)
--% 假定ns难度序列是主难度序列的前缀
if next(detail) then return detail[type] end
for idx, tag in ipairs(colTags) do
local inter = { fragment = {}, previous = {}, potential = {}, partner = {} }
local chart = {}
function type2Key(t)
charts:insert(chart)
if t == 0 then return "fragment"
local diff = song.difficulties[idx]
elseif t < 5 then return "previous"
 
elseif t == 5 then return "potential"
local class = ({[0] = 'PST', 'PRS', 'FTR', 'BYD', 'ETR'})[diff.ratingClass]
elseif t == 103 then return "partner"
local function chartBasic(df, vd_, s)
chart['rating' .. s] = args[tag .. '等级' .. s] or (df.rating .. (df.ratingPlus and '+' or ''))
chart['note' .. s] = args[tag .. 'Note' .. s]
chart['vdOverride' .. s] = vdValidation(args[tag .. '更新版本' .. s], args[tag .. '更新时间' .. s])
if df.date and not chart['vdOverride' .. s] then notice.vd = true end
chart['vdOverride' .. s] = chart['vdOverride' .. s] or vd_
end
 
chartBasic(diff, vd, '')
if not chart.note then notice.note = true end
 
chart.display = ('<b class="text-%s">[%s]</b>'):format(lang:lc(class), tag)
addCategory(class .. chart.rating .. '级曲目')
chart.designer = args[tag .. 'Note编写'] or args['note编写'] or diff.chartDesigner
chart.bgOverride = args[tag .. '背景'] or diff.bg
if chart.bgOverride then addCategory(bgCatF:format(chart.bgOverride)) end
chart.bgOverride = chart.bgOverride or bg
if diff.title_localized then header:node(br):wikitext(diff.title_localized.en, ' ', chart.display) end
local diffNS = sns.difficulties[idx]
if diffNS then
chartBasic(diffNS, vdNS, 'NS')
if diffNS.has_controller_alt_chart then
notice.alt = true
if not chart.noteNS then notice.note = true end
end
if chart.ratingNS and chart.ratingNS ~= chart.rating then
notice.ratingDiffer = true
end
end
end
end
end
for songk, songv in unlocksIt(unlocks) do
main:tag 'div':addClass 'gc-1 bg-c fs-m':wikitext '谱面信息'
local row = { fragment = {}, previous = {}, potential = {}, partner = {} }
main:tag 'div':addClass 'bg-c central':wikitext '难度'
for rate = 1, 3 do
for _, c in ipairs(charts) do
for _, cond in ipairs(songv[rate] or {}) do
main:tag 'div':addClass 'central fd-c':wikitext(c.display,
local key = type2Key(cond.type)
not notice.ratingDiffer and not c.ratingNS and '仅移动版' or nil)
if key then
end
row[key][rate] = row[key][rate] or {}
main:tag 'div':addClass 'bg-c central':wikitext '等级'
table.insert(row[key][rate], (p.condition(cond)))
for _, c in ipairs(charts) do
end
main:tag 'div':wikitext(c.rating)
end
end
main:tag 'div':addClass 'bg-c central':wikitext 'note数量'
for _, c in ipairs(charts) do
main:tag 'div':wikitext(c.note)
end
main:tag 'div':addClass 'bg-c central':wikitext '谱面设计'
for _, tp in ipairs(merge(charts, 'designer')) do
local data, len = unpack(tp)
main:tag 'div':addClass(span(len)):wikitext(data)
end
if notice.ratingDiffer then
main:tag 'div':addClass 'bg-c central':wikitext '等级NS'
for _, c in ipairs(charts) do
main:tag 'div':wikitext(c.ratingNS)
end
end
for key, kind in pairs(row) do
end
if kind[3] then
if notice.alt then
table.insert(inter[key], {
addCategory '多模式谱面有差异的曲目'
table.concat(kind[1] or { " " }, "<br>"),
main:tag 'div':addClass 'bg-c central':wikitext 'note数量<br>(Joy-Con)'
table.concat(kind[2] or { " " }, "<br>"),
for _, c in ipairs(charts) do
table.concat(kind[3], "<br>"), id = songk
main:tag 'div':wikitext(c.noteNS)
})
end
end
end
end
end
local slst = mw.loadData "Module: 沙盒/盐棋/Sandbox1".slst
main:tag 'div':addClass 'bg-c central':wikitext '背景'
local plst = mw.loadData "Module: 沙盒/盐棋/Sandbox2"
for _, tp in ipairs(merge(charts, 'bgOverride')) do
for key, songs in pairs(inter) do
local data, len = unpack(tp)
table.sort(songs, function(a, b)
main:tag 'div':addClass(span(len)):wikitext(data and bgLinkF:format(data, data))
local d = plst[slst[slstIdx[a.id].idx].set].idx - plst[slst[slstIdx[b.id].idx].set].idx
end
if d ~= 0 then return d < 0 else return slst[slstIdx[a.id].idx].date < slst[slstIdx[b.id].idx].date end
 
end)
 
--- wikitable
main:tag 'div':addClass 'bg-c central':addClass(platCode == 3 and 'gr-s2' or nil):wikitext '更新时间'
local wtb, pid = {}, ""
for _, tp in ipairs(merge(charts, 'vdOverride')) do
for _, song in ipairs(songs) do
local data, len = unpack(tp)
if pid ~= slst[slstIdx[song.id].idx].set then
dateCov(main:tag 'div':addClass(span(len)), data, '移动版')
pid = slst[slstIdx[song.id].idx].set
end
table.insert(wtb, '|-\n| colspan="4" |[[' .. plst[pid].name .. "]]")
if platCode == 3 then
end
for _, tp in ipairs(merge(charts, 'vdOverrideNS')) do
table.insert(wtb, table.concat({ "|-\n|[[" .. slstIdx[song.id].title .. "]]", unpack(song) }, "||"))
local data, len = unpack(tp)
dateCov(main:tag 'div':addClass(span(len)), data, 'NS版')
end
end
detail[key] = table.concat({
'{| class="wikitable mw-collapsible mw-collapsed" style="text-align:center"',
"|-\n!曲目!!Past!!Present!!Future",
table.concat(wtb, "\n"),
"|}"
}, "\n")
end
end
return detail[type]
 
local noticeText = ''
for _, v in ipairs {
{'data', '在Songlist中无法检查到此曲目。请尝试更新[[模板:Songlist]],检查页面名或填写正确的<code>曲名</code>参数。'},
{'duration', '此模板缺少<code>时长</code>参数,此参数无法自动读取。'},
{'pack', '未更新Packlist。曲目信息模板无法进行曲包分类。'},
{'vd', '此模板的更新版本是未完整状态。请添加<code>更新版本</code>与<code>更新时间</code>参数。'},
{'note', '此模板缺少某种<code>Note</code>参数,此参数无法自动读取。'},
} do
local msg, text = unpack(v)
if notice[msg] then noticeText = noticeText .. text end
end
if noticeText ~= '' then
noticeText = mw.getCurrentFrame():expandTemplate {title = 'Collapse', args = {['标题'] = '曲目信息模板提示信息', ['状态'] = '折叠',
['标题文字方向'] = 'center', ['标题颜色'] = '#dddddd',
['内容颜色'] = '#eeeeee', ['内容样式'] = 'width:800px',
['style'] = 'display:table;width:200px', ['class'] = 'nomobile',
['内容'] = noticeText}}
addCategory '缺少参数的曲目信息模板'
end
return tostring(box) .. noticeText .. (args['nocat'] and '' or table.concat(category))
-- .. tostring(mw.html.create 'pre':wikitext(mw.dumpObject(charts)))
end
end
-- p.dateCov = dateCov
function p.main(frame)
local args = getArgs(frame)
return auto(args)
end
return p
return p

2024年3月13日 (三) 05:32的最新版本

可在Module:沙盒/盐棋/Sandbox/doc创建此模块的帮助文档

local getArgs = require 'Module:Arguments'.getArgs
-- local link = require 'Module:Link'._link
local mad = require 'Module:AnotherData'
local lang = mw.language.getContentLanguage()
local p = {}

local bgLinkF = '[[:分类:采用%s背景的曲目|%s]]'
local bgCatF = '采用%s背景的曲目'
local function array(...) return setmetatable({...}, {__index = table}) end
local function onlySupScript(s) return mw.getCurrentFrame():expandTemplate {title = '仅', args = {s, '', '图片角标'}} end
local function vdValidation(v, d) return v and d and {v, d} end
local function labelText(text) return mw.html.create 'span':addClass 'bg-c label':wikitext(text) end
local br = mw.html.create 'br'
local function dateCov(dateBox, data, plat)
	if not data then return end
	local version, date = unpack(data)
	dateBox:tag 'div':node(labelText(plat)):node(br):wikitext(version):node(br):wikitext('(', date, ')'):done()
end
local function span(len) if len > 1 then return 'gc-s' .. len end end

--	.container
--		.img-tab#tab-a
--			.img-tab-part.{cls} * n
--				{text}
--		.tab-text-a.active? * n
--			{file}[画师]{jacket}
---@param view table<integer,table<integer,string>>
---@param activeIdx integer?
---@return table
local function createContainer(view, activeIdx)
	activeIdx = activeIdx or 1
	local container = mw.html.create 'div':addClass 'container'
	local tab = container:tag 'div':addClass 'img-tab':attr('id', 'tab-a')
	for _, v in ipairs(view) do
		local text, cls = v[1], v[2] or 'normal'
		tab:tag 'div':wikitext(text):addClass 'img-tab-part':addClass(cls):done()
	end
	for idx, v in ipairs(view) do
		local file, jacket = v[3], v[4]
		container
			:tag 'div':addClass 'tab-text-a':addClass(idx == activeIdx and 'active' or nil)
			:wikitext('[[文件:', file, '|', 256, 'px|none]]')
			:node(labelText '画师')
			:wikitext(jacket)
			:done()
	end
	return container
end
local function getImage(args, song)
	local id = song and song.id
	local argPic = args['图片'] or args['曲绘']
	local argArtist = args['画师']
	if args['Beyond画师'] then
		return createContainer {
			{'Normal', nil, argPic, argArtist},
			{'Beyond', 'byd', args['Beyond曲绘'], args['Beyond画师']},
		}
	end
	return mw.html.create 'div'
		:wikitext('[[文件:', id and ('Songs ' .. id .. '.jpg') or argPic, '|', 256, 'px|none]]')
		:node(labelText '画师')
		:wikitext(argArtist)
end
local function tabCustom(args)
	local i = 1
	local res = array()
	while args['tab' .. i] do
		res:insert {mw.ustring.match(args['tab' .. i], '([^/]*)/([^/]*)/([^/]*)/(.*)')}
		i = i + 1
	end
	return res, args['默认图片序号']
end
local function merge(charts, field)
	local res = array()
	local cur, len = charts[1][field], 1
	for _, c in ipairs {}, charts, 1 do
		local e = c[field]
		if e == cur then
			len = len + 1
		else
			res:insert {cur, len}
			cur = e
			len = 1
		end
	end
	res:insert {cur, len}
	return res
end
local function getSet(sm, sns)
	--% 要求名字相同
	local qm, qns = mad.packQueryWrap(sm and sm.set, 'mobile'), mad.packQueryWrap(sns and sns.set, 'ns')
	local namem, namens = qm.section ~= 'unknown' and qm.name or nil, qns.section ~= 'unknown' and qns.name or nil
	local name = namem or namens
	if not name then return nil end
	local res = {name}
	if namens and namens ~= name then table.insert(res, namens .. onlySupScript 'NS版') end
	if #res > 1 then res[1] = res[1] .. onlySupScript '移动版' end
	return table.concat(res, '<br>')
end
-- TODO:displaytitle lowercase
local function getById(list, id)
	for _, k in ipairs(list) do if k.id == id then return k end end
end
local function getByTitle(list, title)
	for _, k in ipairs(list) do if k.title_localized.en == title then return k end end
end
local function auto(args)
	local category = {}
	local function addCategory(item)
		table.insert(category, '[[分类:' .. item .. ']]')
	end
	local notice = {}

	--% "曲名"必存在,"id"必非空串
	local songKey, getDatum = args['id'], getById
	if not songKey then songKey, getDatum = mw.text.decode(args['曲名']), getByTitle end
	local lm, lns
	if args['愚人节'] then
		lm, lns = mad.listOfReserve(), array()
	elseif songKey == 'Last' then
		lm, lns = mad.listOfReserve(), mad.listOfReserve()
	else
		lm, lns = mad.listOf('songs', 'mobile'), mad.listOf('songs', 'ns')
	end
	local sm, sns = getDatum(lm, songKey), getDatum(lns, songKey)
	--% 可能平台不一致
	local set = args['曲包'] or getSet(sm, sns)
	local platCode = (sm and 1 or 0) + (sns and 2 or 0)
	local song = sm or sns
	if not (sns and sns ~= song) then sns = {difficulties = array()} end
	if not song then
		notice.data = true
		song = mad.listOfReserve()[1]
		song.title_localized.en = songKey
	end

	local box = mw.html.create 'div':addClass 'infotable'
	local header = box:tag 'div':addClass 'header bg-c fs-l':wikitext(song.title_localized.en)
	if song.title_localized.ja then header:node(br):node 'span':attr {lang = 'ja'}:wikitext(song.title_localized.ja) end
	if song.title_localized['zh-Hans'] then header:node(br):wikitext(song.title_localized['zh-Hans']) end
	box:tag 'div':addClass 'figure central':node(args['tab1'] and createContainer(tabCustom(args)) or getImage(args, song))
	--% :create''
	local main = box:tag 'div':addClass 'main'

	addCategory(({'移动版曲目', 'NS版曲目', '双平台曲目'})[platCode])
	local sideCode = (tonumber(args['侧']) or song.side) + 1
	box:addClass(({'light', 'conflict', 'colorless'})[sideCode])
	addCategory(({'光芒侧曲目', '纷争侧曲目', '消色侧曲目'})[sideCode])
	local colTags = array()
	for idx, diff in ipairs(song.difficulties) do
		colTags[idx] = diff['@tag'] or ({[0] = 'Past', 'Present', 'Future', 'Beyond', 'Eternal'})[diff.ratingClass]
	end
	main:addClass('repeat-' .. #colTags)

	local artist = args['编曲'] or args['曲师'] or song.artist
	if not set then notice.pack = true end
	-- addCategory %set曲包曲目
	local duration = args['时长']
	if not duration then notice.duration = true end
	local bpm = args['BPM'] or song.bpm
	main:tag 'div':addClass 'gc-1 bg-c fs-m':wikitext '曲目信息'
	for _, v in ipairs {{'曲师', artist}, {'曲包', set}, {'时长', duration}, {'BPM', bpm},} do
		local tag, data = unpack(v)
		main:tag 'div':addClass 'bg-c central':wikitext(tag):done()
			:tag 'div':addClass 'gc-2':wikitext(data)
	end

	local bg = args['背景'] or song.bg
	if bg then addCategory(bgCatF:format(bg)) end
	local vd = vdValidation(args['更新版本'], args['更新时间'])
	if not vd then notice.vd = true end
	local vdNS
	if sns.id then
		vdNS = vdValidation(args['更新版本NS'], args['更新时间NS'])
		if not vdNS then notice.vd = true end
	end

	local charts = array()
	--% 假定ns难度序列是主难度序列的前缀
	for idx, tag in ipairs(colTags) do
		local chart = {}
		charts:insert(chart)
		local diff = song.difficulties[idx]

		local class = ({[0] = 'PST', 'PRS', 'FTR', 'BYD', 'ETR'})[diff.ratingClass]
		local function chartBasic(df, vd_, s)
			chart['rating' .. s] = args[tag .. '等级' .. s] or (df.rating .. (df.ratingPlus and '+' or ''))
			chart['note' .. s] = args[tag .. 'Note' .. s]
			chart['vdOverride' .. s] = vdValidation(args[tag .. '更新版本' .. s], args[tag .. '更新时间' .. s])
			if df.date and not chart['vdOverride' .. s] then notice.vd = true end
			chart['vdOverride' .. s] = chart['vdOverride' .. s] or vd_
		end

		chartBasic(diff, vd, '')
		if not chart.note then notice.note = true end

		chart.display = ('<b class="text-%s">[%s]</b>'):format(lang:lc(class), tag)
		addCategory(class .. chart.rating .. '级曲目')
		chart.designer = args[tag .. 'Note编写'] or args['note编写'] or diff.chartDesigner
		chart.bgOverride = args[tag .. '背景'] or diff.bg
		if chart.bgOverride then addCategory(bgCatF:format(chart.bgOverride)) end
		chart.bgOverride = chart.bgOverride or bg
		if diff.title_localized then header:node(br):wikitext(diff.title_localized.en, ' ', chart.display) end
		local diffNS = sns.difficulties[idx]
		if diffNS then
			chartBasic(diffNS, vdNS, 'NS')
			if diffNS.has_controller_alt_chart then
				notice.alt = true
				if not chart.noteNS then notice.note = true end
			end
			if chart.ratingNS and chart.ratingNS ~= chart.rating then
				notice.ratingDiffer = true
			end
		end
	end
	main:tag 'div':addClass 'gc-1 bg-c fs-m':wikitext '谱面信息'
	main:tag 'div':addClass 'bg-c central':wikitext '难度'
	for _, c in ipairs(charts) do
		main:tag 'div':addClass 'central fd-c':wikitext(c.display,
			not notice.ratingDiffer and not c.ratingNS and '仅移动版' or nil)
	end
	main:tag 'div':addClass 'bg-c central':wikitext '等级'
	for _, c in ipairs(charts) do
		main:tag 'div':wikitext(c.rating)
	end
	main:tag 'div':addClass 'bg-c central':wikitext 'note数量'
	for _, c in ipairs(charts) do
		main:tag 'div':wikitext(c.note)
	end
	main:tag 'div':addClass 'bg-c central':wikitext '谱面设计'
	for _, tp in ipairs(merge(charts, 'designer')) do
		local data, len = unpack(tp)
		main:tag 'div':addClass(span(len)):wikitext(data)
	end
	if notice.ratingDiffer then
		main:tag 'div':addClass 'bg-c central':wikitext '等级NS'
		for _, c in ipairs(charts) do
			main:tag 'div':wikitext(c.ratingNS)
		end
	end
	if notice.alt then
		addCategory '多模式谱面有差异的曲目'
		main:tag 'div':addClass 'bg-c central':wikitext 'note数量<br>(Joy-Con)'
		for _, c in ipairs(charts) do
			main:tag 'div':wikitext(c.noteNS)
		end
	end
	main:tag 'div':addClass 'bg-c central':wikitext '背景'
	for _, tp in ipairs(merge(charts, 'bgOverride')) do
		local data, len = unpack(tp)
		main:tag 'div':addClass(span(len)):wikitext(data and bgLinkF:format(data, data))
	end


	main:tag 'div':addClass 'bg-c central':addClass(platCode == 3 and 'gr-s2' or nil):wikitext '更新时间'
	for _, tp in ipairs(merge(charts, 'vdOverride')) do
		local data, len = unpack(tp)
		dateCov(main:tag 'div':addClass(span(len)), data, '移动版')
	end
	if platCode == 3 then
		for _, tp in ipairs(merge(charts, 'vdOverrideNS')) do
			local data, len = unpack(tp)
			dateCov(main:tag 'div':addClass(span(len)), data, 'NS版')
		end
	end

	local noticeText = ''
	for _, v in ipairs {
		{'data', '在Songlist中无法检查到此曲目。请尝试更新[[模板:Songlist]],检查页面名或填写正确的<code>曲名</code>参数。'},
		{'duration', '此模板缺少<code>时长</code>参数,此参数无法自动读取。'},
		{'pack', '未更新Packlist。曲目信息模板无法进行曲包分类。'},
		{'vd', '此模板的更新版本是未完整状态。请添加<code>更新版本</code>与<code>更新时间</code>参数。'},
		{'note', '此模板缺少某种<code>Note</code>参数,此参数无法自动读取。'},
	} do
		local msg, text = unpack(v)
		if notice[msg] then noticeText = noticeText .. text end
	end
	if noticeText ~= '' then
		noticeText = mw.getCurrentFrame():expandTemplate {title = 'Collapse', args = {['标题'] = '曲目信息模板提示信息', ['状态'] = '折叠',
			['标题文字方向'] = 'center', ['标题颜色'] = '#dddddd',
			['内容颜色'] = '#eeeeee', ['内容样式'] = 'width:800px',
			['style'] = 'display:table;width:200px', ['class'] = 'nomobile',
			['内容'] = noticeText}}
		addCategory '缺少参数的曲目信息模板'
	end
	return tostring(box) .. noticeText .. (args['nocat'] and '' or table.concat(category))
	-- .. tostring(mw.html.create 'pre':wikitext(mw.dumpObject(charts)))
end
-- p.dateCov = dateCov
function p.main(frame)
	local args = getArgs(frame)
	return auto(args)
end

return p