Jump to content

Module:Aligned table: Difference between revisions

try new optional noblankrows feature
(strip trailing whitespace from cells, leading whitespace is needed for list markup, but should be safe to remove trailing space)
(try new optional noblankrows feature)
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 148: Line 161:
end
end
cell:wikitext(mw.ustring.gsub(args[cols*(j - 1) + i] or '','%s*$', ''))
cell:wikitext(mw.ustring.gsub(args[cols*(j - 1) + i] or '','%s*$', ''))
end
end
end
end
end
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.