Module:Sandbox/ChaoticShadow/SongDataLine
Documentation for this module may be created at Module:Sandbox/ChaoticShadow/SongDataLine/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
local args = {}
local root
local units = {
vs = 'VIRTUAL SINGER',
ln = 'Leo/need',
mmj = 'MORE MORE JUMP!',
vbs = 'Vvid BAD SQUAD',
wxs = 'Wonderlands × Showtime',
['25ji'] = '25-ji, Night Code de.',
mix = 'Mixed'
}
local colors = {
vs = { bg = '#00CDBA', text = '#FFFFFF' },
ln = { bg = '#4455DD', text = '#FFFFFF' },
mmj = { bg = '#6CCB20', text = '#FFFFFF' },
vbs = { bg = '#EE1166', text = '#FFFFFF' },
wxs = { bg = '#FF9900', text = '#FFFFFF' },
['25ji'] = { bg = '#884499', text = '#FFFFFF' },
mix = { bg = '#81ebee', text = '#000000' }
}
local palette = { bg = '#FFFFFF', text = '#000000' }
local function addCell(value, default, css)
local content = value or default
root:tag('td')
:css(css or {})
:wikitext(content)
end
function p.main(frame)
args = getArgs(frame)
if args.unit and colors[args.unit] then
palette = colors[args.unit]
end
root = mw.html.create('tr')
addCell(args[1] or args.id, '-1')
addCell(args[2] or args.song, '')
addCell(args.producer, '')
addCell(units[args.unit], '', {
['background-color']= palette.bg,
['color']= palette.text
})
addCell(args.mv, '✕')
addCell(args.date, '')
addCell(args.bpm, '')
addCell(args.duration, '')
local diffs = mw.text.split(args.difficulties or '', ',')
for i=1,5,1 do
addCell(diffs[i], '')
end
local notes = mw.text.split(args.notes or '', ',')
for i=1,5,1 do
addCell(notes[i], '')
end
return tostring(root)
end
return p