Module:TableGenerator: Difference between revisionsGive feedback
m better examples |
mNo edit summary |
||
| Line 57: | Line 57: | ||
-- Initialize the HTML table structure | -- Initialize the HTML table structure | ||
local result = '' | local result = '' | ||
if not onlyBody then | if not onlyBody then | ||
result = result .. '<table class="wikitable">\n' | result = result .. '<table class="wikitable">\n' | ||
| Line 68: | Line 68: | ||
-- If it's the start of a new row | -- If it's the start of a new row | ||
if count % cols == 0 then | if count % cols == 0 then | ||
if count > 0 then | |||
result = result .. ' </tr>\n' | |||
end | |||
result = result .. ' <tr>\n' | result = result .. ' <tr>\n' | ||
end | end | ||
| Line 74: | Line 77: | ||
result = result .. ' <td>' .. value .. '</td>\n' | result = result .. ' <td>' .. value .. '</td>\n' | ||
count = count + 1 | count = count + 1 | ||
end | end | ||
end | end | ||
-- Close | -- Close the last row if necessary | ||
if count % cols ~= 0 then | if count % cols ~= 0 then | ||
result = result .. ' </tr>\n' | result = result .. ' </tr>\n' | ||