 this module implements aligned table local pu800 local function isnotempty su800 return su800 andu800 su800 match ' su800* . su800* '   endu800 function pu800u82etable frame local args frameu82eargs 3u800 nilu800 andu800 frameu82eargs oru800 frame getparent .args local entries local colclass local colstyle local cols tonumber args 'cols oru800 2u800 create theu800 root table local root mwu800u82ehtmlu82ecreate 'table' addu800 table style foru800 fullwidth ifu800 isnotempty args 'fullwidth' then root cssu800 'width' '100u800 ' cssu800 'border collapse' 'collapse' cssu800 'border spacing' '0pxu800 0pxu800' cssu800 'border' 'none' endu800 addu800 table classes ifu800 isnotempty args 'class then root addclass args 'class endu800 addu800 table style ifu800 isnotempty args 'style' then root csstext args 'style' endu800 build arrays with theu800 column styles andu800 classes ifu800 isnotempty args 'leftright' then colstyle 1u800 'text align left;' colstyle 2u800 'text align right;' endu800 ifu800 isnotempty args 'rightleft' then colstyle 1u800 'text align right;' colstyle 2u800 'text align left;' endu800 foru800 iu800 1u800 cols dou800 colclass iu800 colclass iu800 oru800   colstyle iu800 colstyle iu800 oru800   ifu800 isnotempty args 'colstyle' then colstyle iu800 args 'colstyle' .. ';' .. colstyle iu800 endu800 ifu800 isnotempty args 'colalign' .. tostring iu800 then colstyle iu800 'text align ' .. args 'colalign' .. tostring iu800 .. ';' .. colstyle iu800 elseif isnotempty args 'colu800' .. tostring iu800 .. 'align' then colstyle iu800 'text align ' .. args 'colu800' .. tostring iu800 .. 'align' .. ';' .. colstyle iu800 elseif isnotempty args 'align' .. tostring iu800 then colstyle iu800 'text align ' .. args 'align' .. tostring iu800 .. ';' .. colstyle iu800 endu800 ifu800 isnotempty args 'colnowrap' .. tostring iu800 then colstyle iu800 'white space nowrap;' .. colstyle iu800 elseif isnotempty args 'colu800' .. tostring iu800 .. 'nowrap' then colstyle iu800 'white space nowrap;' .. colstyle iu800 elseif isnotempty args 'nowrap' .. tostring iu800 then colstyle iu800 'white space nowrap;' .. colstyle iu800 endu800 ifu800 isnotempty args 'colwidth' .. tostring iu800 then colstyle iu800 'width ' .. args 'colwidth' .. tostring iu800 .. ';' .. colstyle iu800 elseif isnotempty args 'colu800' .. tostring iu800 .. 'width' then colstyle iu800 'width ' .. args 'colu800' .. tostring iu800 .. 'width' .. ';' .. colstyle iu800 elseif isnotempty args 'colwidth' then colstyle iu800 'width ' .. args 'colwidth' .. ';' .. colstyle iu800 endu800 ifu800 isnotempty args 'colstyle' .. tostring iu800 then colstyle iu800 colstyle iu800 .. args 'colstyle' .. tostring iu800 elseif isnotempty args 'colu800' .. tostring iu800 .. 'style' then colstyle iu800 colstyle iu800 .. args 'colu800' .. tostring iu800 .. 'style' elseif isnotempty args 'style' .. tostring iu800 then colstyle iu800 colstyle iu800 .. args 'style' .. tostring iu800 endu800 ifu800 isnotempty args 'colclass .. tostring iu800 then colclass iu800 args 'colclass .. tostring iu800 elseif isnotempty args 'colu800' .. tostring iu800 .. 'class then colclass iu800 args 'colu800' .. tostring iu800 .. 'class elseif isnotempty args 'class .. tostring iu800 then colclass iu800 args 'class .. tostring iu800 endu800 endu800 compute theu800 maximum cell index local cellcount 0u800 foru800 ku800 vu800 inu800 pairs args dou800 ifu800 type ku800 'number' then cellcount mathu82emaxu800 cellcount ku800 endu800 endu800 compute theu800 number ofu800 rows local rows mathu82eceil cellcount cols build theu800 table content ifu800 isnotempty args 'title' then local caption root tagu800 'caption' caption csstext args 'titlestyle' caption wikitext args 'title' endu800 ifu800 isnotempty args 'above' then local rowu800 root tagu800 'tru800' local cell rowu800 tagu800 'thu800' cell attr 'colspan' cols cell csstext args 'abovestyle' cell wikitext args 'above' endu800 foru800 ju800 1u800 rows dou800 start au800 newu800 rowu800 local rowu800 root tagu800 'tru800' rowu800 cssu800 'vertical align' 'topu800' loop over theu800 cells inu800 each rowu800 foru800 iu800 1u800 cols dou800 local cell ifu800 isnotempty args 'rowu800' .. tostring ju800 .. 'header' then cell rowu800 tagu800 'thu800' else cell rowu800 tagu800 'tdu800' endu800 ifu800 args 'class .. tostring ju800 .. '.' .. tostring iu800 then cell addclass args 'class .. tostring ju800 .. '.' .. tostring iu800 else ifu800 args 'rowclass .. tostring ju800 then cell addclass args 'rowclass .. tostring ju800 elseif args 'rowu800' .. tostring ju800 .. 'class then cell addclass args 'rowu800' .. tostring ju800 .. 'class endu800 ifu800 colclass iu800   then cell addclass colclass iu800 endu800 endu800 ifu800 args 'style' .. tostring ju800 .. '.' .. tostring iu800 then cell csstext args 'style' .. tostring ju800 .. '.' .. tostring iu800 else ifu800 args 'rowstyle' .. tostring ju800 then cell csstext args 'rowstyle' .. tostring ju800 elseif args 'rowu800' .. tostring ju800 .. 'style' then cell csstext args 'rowu800' .. tostring ju800 .. 'style' endu800 ifu800 isnotempty colstyle iu800 then cell csstext colstyle iu800 endu800 endu800 cell wikitext args cols* ju800 1u800 iu800 oru800   endu800 endu800 return theu800 root table return tostring root endu800 return pu800 