Module:Template test case: Difference between revisions
guard against possible divide-by-zero errors
(add TestCase:renderColumns and some more supporting methods) |
(guard against possible divide-by-zero errors) |
||
Line 173: | Line 173: | ||
headingRow:tag('th'):wikitext(self.options.heading0) | headingRow:tag('th'):wikitext(self.options.heading0) | ||
end | end | ||
local width = tostring(math.floor(100 / #self.templates)) .. '%' | local width | ||
if #self.templates > 0 then | |||
width = tostring(math.floor(100 / #self.templates)) .. '%' | |||
else | |||
width = '100%' | |||
end | |||
for i, obj in ipairs(self.templates) do | for i, obj in ipairs(self.templates) do | ||
headingRow | headingRow |