2,525
次編輯
小 (songtable) |
小 (songtable) |
||
行 47: | 行 47: | ||
end | end | ||
local function getImage(args, song) | local function getImage(args, song) | ||
local id = song | local id = song and song.id | ||
local argPic = args['图片'] or args['曲绘'] | local argPic = args['图片'] or args['曲绘'] | ||
local argArtist = args['图片'] or args['曲绘'] | local argArtist = args['图片'] or args['曲绘'] | ||
行 57: | 行 57: | ||
end | end | ||
return mw.html.create 'div' | return mw.html.create 'div' | ||
:wikitext('[[文件:', id and 'Songs ' .. id .. '.jpg' or | :wikitext('[[文件:', id and ('Songs ' .. id .. '.jpg') or argPic, '|', 256, 'px|none]]') | ||
:node(labelText '画师') | :node(labelText '画师') | ||
:wikitext(argArtist) | :wikitext(argArtist) | ||
行 182: | 行 182: | ||
local class = ({[0] = 'PST', 'PRS', 'FTR', 'BYD', 'ETR'})[diff.ratingClass] | local class = ({[0] = 'PST', 'PRS', 'FTR', 'BYD', 'ETR'})[diff.ratingClass] | ||
local function chartBasic(df, vd, s) | local function chartBasic(df, vd, s) | ||
chart['rating' .. s] = args[tag .. '等级' .. s] or (df.rating .. (df.ratingPlus and '+' or '')) | chart['rating' .. s] = args[tag .. '等级' .. s] or (df.rating .. (df.ratingPlus and '+' or '')) | ||
行 195: | 行 193: | ||
if not chart.note then notice.note = true end | if not chart.note then notice.note = true end | ||
chart.display = ('<span class="text-%s">[%s]</span>'):format(lang:lc(class), tag) | |||
addCategory(class .. chart.rating .. '级曲目') | |||
chart.designer = args[tag .. 'Note编写'] or args['note编写'] or diff.chartDesigner | chart.designer = args[tag .. 'Note编写'] or args['note编写'] or diff.chartDesigner | ||
chart.bgOverride = args[tag .. '背景'] or diff.bg | chart.bgOverride = args[tag .. '背景'] or diff.bg | ||
行 244: | 行 244: | ||
for _, tp in ipairs(merge(charts, 'bgOverride')) do | for _, tp in ipairs(merge(charts, 'bgOverride')) do | ||
local data, len = unpack(tp) | local data, len = unpack(tp) | ||
main:tag 'div':addClass(span(len)):wikitext(data and bgLinkF:format(data)) | main:tag 'div':addClass(span(len)):wikitext(data and bgLinkF:format(data, data)) | ||
end | end | ||
行 279: | 行 279: | ||
category:add '缺少参数的曲目信息模板' | category:add '缺少参数的曲目信息模板' | ||
end | end | ||
return tostring(box) .. | return tostring(box) .. noticeText .. (args['nocat'] and '' or table.concat(category)) | ||
end | end | ||
次編輯