Difference between revisions of "Module:Bundles"

Jump to navigation Jump to search
2 bytes removed ,  21:45, 24 October 2021
no edit summary
Line 6: Line 6:
currentRow = mw.text.split(currentRow, ';')
currentRow = mw.text.split(currentRow, ';')
objects = table.getn(currentRow)
objects = table.getn(currentRow)
rowGroup = {}
rowGroup = ''
for k, v in ipairs(currentRow) do
for k, v in ipairs(currentRow) do
vs = mw.text.split(v, '-')
vs = mw.text.split(v, '-')
Line 12: Line 12:
object = mw.html.create('span')
object = mw.html.create('span')
:wikitext(icon.icon(vs[1], vs[2], nil, 'no'))
:wikitext(icon.icon(vs[1], vs[2], nil, 'no'))
table.insert(rowGroup, k, object)
rowGroup = rowGroup .. tostring(object)
if k ~= objects then
if k ~= objects then
object = mw.html.create('span')
object = mw.html.create('span')
Line 18: Line 18:
:wikitext(' + ')
:wikitext(' + ')
end
end
table.insert(rowGroup, k+0.5, object)
rowGroup = rowGroup .. tostring(object)
end
end
for k, v in pairs(rowGroup) do
for k, v in pairs(rowGroup) do
Line 25: Line 25:
result = mw.html.create('div')
result = mw.html.create('div')
result:addClass('bundle-row bundle-col-' .. objects)
result:addClass('bundle-row bundle-col-' .. objects)
result:wikitext(tostring(rowGroup))
result:wikitext(rowGroup)
return result
return result

Navigation menu