Module:Aligned table: Difference between revisions

start conversion to mw.html
(rowstyle and rowclass)
(start conversion to mw.html)
Line 17: Line 17:
colstyle[1] = 'text-align:left;'
colstyle[1] = 'text-align:left;'
colstyle[2] = 'text-align:right;'
colstyle[2] = 'text-align:right;'
    end
end
 
local root = mw.html.create('table')
if fullwidth ~= '' then
if fullwidth ~= '' then
style = 'width:100%; border-collapse: collapse; border-spacing: 0px; border:none;' .. style
root
:css('width', '100%')
:css('border-collapse', 'collapse')
:css('border-spacing', '0px')
:css('border', 'none')
end
end
if class ~= '' then
if class ~= '' then
class = ' class="' .. class .. '"'
root:addClass(class)
end
end
if style ~= '' then
if style ~= '' then
style = ' style="' .. style .. '"'
root:cssText(style)
end
end
for i = 1,cols do
for i = 1,cols do
colclass[ i ] = colclass[ i ] or ''
colclass[ i ] = colclass[ i ] or ''
Line 73: Line 79:
         end
         end
     end
     end
     return '<table' .. class .. style ..'>\n' .. table.concat( entries, '\n' ) .. '\n</table>'
     root:wikitext(table.concat( entries, '\n' ))
      
 
     return tostring(root)
  end
  end


return p
return p
Anonymous user