Jump to content

Module:Aligned table: Difference between revisions

more mw.html
(start conversion to mw.html)
(more mw.html)
Line 55: Line 55:
i = math.fmod(k-1,cols) + 1
i = math.fmod(k-1,cols) + 1
local j = (k - i) / cols + 1
local j = (k - i) / cols + 1
local tdstyle = ''
local cell = mw.html.create('td')
if args['class' .. tostring(j) .. '.' .. tostring(i)] then
if args['class' .. tostring(j) .. '.' .. tostring(i)] then
tdstyle = tdstyle .. ' class="' .. args['class' .. tostring(j) .. '.' .. tostring(i)] .. '"'
cell:addClass(args['class' .. tostring(j) .. '.' .. tostring(i)])
elseif args['rowclass' .. tostring(j)] then
elseif args['rowclass' .. tostring(j)] then
tdstyle = tdstyle .. ' class="' .. args['rowclass' .. tostring(j)] .. '"'
cell:addClass(args['rowclass' .. tostring(j)] .. '"')
elseif colclass[i] ~= '' then
elseif colclass[i] ~= '' then
tdstyle = tdstyle .. ' class="' .. colclass[i] .. '"'
cell:addClass(colclass[i])
end
end
if args['style' .. tostring(j) .. '.' .. tostring(i)] then
if args['style' .. tostring(j) .. '.' .. tostring(i)] then
tdstyle = tdstyle .. ' style="' .. args['style' .. tostring(j) .. '.' .. tostring(i)] .. '"'
cell:cssText(args['style' .. tostring(j) .. '.' .. tostring(i)])
elseif args['rowstyle' .. tostring(j)] then
elseif args['rowstyle' .. tostring(j)] then
tdstyle = tdstyle .. ' style="' .. args['rowstyle' .. tostring(j)] .. '"'
cell:cssText(args['rowstyle' .. tostring(j)])
elseif colstyle[i] ~= '' then
elseif colstyle[i] ~= '' then
tdstyle = tdstyle .. ' style="' .. colstyle[i] .. '"'
cell:cssText(colstyle[i])
end
end
entries[ k ] = '<td' .. tdstyle .. '>' .. v .. '</td>'
cell:wikitext(v)
entries[ k ] = tostring(cell)
if i == 1 then
if i == 1 then
entries[ k ] = '<tr style="vertical-align:top">' .. entries[ k ]
entries[ k ] = '<tr style="vertical-align:top">' .. entries[ k ]
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.