Module:Aligned table: Difference between revisions

should work now
No edit summary
(should work now)
Line 12: Line 12:
local colstyle = {}
local colstyle = {}
local cols = tonumber(args['cols']) or 2
local cols = tonumber(args['cols']) or 2
local noblankrows = args['noblankrows'] or ''


-- create the root table
-- create the root table
Line 113: Line 114:
row:css('vertical-align', 'top')
row:css('vertical-align', 'top')
end
end
-- loop over the cells in each row
-- skip blank rows, if feature is enabled
local showrow = 1
if isnotempty(noblankrows) then
showrow = 0
for i=1,cols do
if isnotempty(args[cols*(j - 1) + i] or '') then
showrow = 1
break
end
end
end
-- loop over the cells in the row
if showrow then
for i=1,cols do
for i=1,cols do
local cell
local cell
Line 147: Line 160:
end
end
end
end
cell:wikitext(args[cols*(j - 1) + i] or '')
cell:wikitext(mw.ustring.gsub(args[cols*(j - 1) + i] or '', '^(.-)%s*$', '%1') or '')
end
end
end
end
end
Anonymous user