2,788
edits
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
if data.sections then | if data.sections then | ||
for _, section in ipairs(data.sections) do | for _, section in ipairs(data.sections) do | ||
local num_items = #section | |||
for i, item in ipairs(section) do | |||
local row_class = "" | |||
if i == 1 then | |||
row_class = ' class="infobox-section-toprow"' | |||
elseif i == num_items then | |||
row_class = ' class="infobox-section-bottomrow"' | |||
end | end | ||
if (not item.label) or (not item.value) then | |||
error("each item must have a label and value") | |||
end | |||
ret = ret .. '\n|-' .. row_class | |||
ret = ret .. '\n! ' .. item.label .. ' | ' .. item.value | |||
end | end | ||
end | end | ||
Line 46: | Line 44: | ||
i = i + 2 | i = i + 2 | ||
end | end | ||
if #section > 0 then table.insert(data.sections, section | if #section > 0 then table.insert(data.sections, section) end | ||
i = i + 1 | i = i + 1 | ||
end | end | ||
return export.make_infobox(data) | return export.make_infobox(data) | ||
end | end | ||
return export | return export |