Module:Aligned table: Difference between revisions
tidy minor spacing/tabs;
(add colwidth per request) |
(tidy minor spacing/tabs;) |
||
Line 16: | Line 16: | ||
local root = mw.html.create('table') | local root = mw.html.create('table') | ||
-- add table style for fullwidth | -- add table style for fullwidth | ||
if isnotempty(args['fullwidth']) then | if isnotempty(args['fullwidth']) then | ||
root | root | ||
:css('width', '100%') | :css('width', '100%') | ||
:css('border-collapse', 'collapse') | :css('border-collapse', 'collapse') | ||
:css('border-spacing', '0px') | :css('border-spacing', '0px 0px') | ||
:css('border', 'none') | :css('border', 'none') | ||
end | end | ||
Line 88: | Line 88: | ||
-- compute the number of rows | -- compute the number of rows | ||
local rows = math.ceil(cellcount / cols) | local rows = math.ceil(cellcount / cols) | ||
-- build the table content | -- build the table content | ||
for j=1,rows do | for j=1,rows do | ||
Line 116: | Line 116: | ||
end | end | ||
cell:wikitext(args[cols*(j - 1) + i] or '') | cell:wikitext(args[cols*(j - 1) + i] or '') | ||
end | |||
end | |||
-- return the root table | -- return the root table | ||
return tostring(root) | |||
end | |||
return p | return p |