Module:User:Xuanmien/navbar

local export = {}

local data = { ['kaito'] = { name = 'KAITO', links = { { '~', '~', },			{ '~ (VOCALOID1)', 'VOCALOID1', }, { '~ V3', 'V3', }, }	},

['leon'] = { name = 'LEON', links = { { '~', '~', },			{ '~ (VOCALOID1)', 'VOCALOID1', }, }	},

['lola'] = { name = 'LOLA', links = { { '~', '~', },			{ '~ (VOCALOID1)', 'VOCALOID1', }, }	},

['meiko'] = { name = 'MEIKO', links = { { '~', '~', },			{ '~ (VOCALOID1)', 'VOCALOID1', }, { '~ V3', 'V3', }, }	},

['miriam'] = { name = 'MIRIAM', links = { { '~', '~', },			{ '~ (VOCALOID1)', 'VOCALOID1', }, }	}, }

local filler = mw.text.tag('i', {}, '&#32;')

function export.show(frame) local voc_abbr = frame.args[1]

local voc_data = data[voc_abbr]

local navbar = mw.html.create('span'):attr('class', 'navbar-container') local navbar_contents = {}

for i, item in ipairs(voc_data.links) do		item[2] = mw.text.tag('span', { style = 'background:#95d2d3; color:#6e6e6e' }, item[2])

local link =  .. item[2] .. 

link = mw.ustring.gsub(link, '~', voc_data.name)

table.insert(navbar_contents, link) end

navbar:wikitext(table.concat(navbar_contents, filler))

navbar = tostring(navbar)

return navbar end

return export