localp={}localfunctionisnotempty(s)returnsands:match('^%s*(.-)%s*$')~=''endfunctionp.table(frame)localargs=(frame.args[1]~=nil)andframe.argsorframe:getParent().argslocalcols=isnotempty(args['3ecoltitre'])and3or2-- compute the maximum cell indexlocalcellcount=0fork,vinpairs(args)doiftype(k)=='number'andisnotempty(v)thencellcount=math.max(cellcount,k)endend-- compute the number of rowslocalrows=math.ceil(cellcount/cols)-- create the root tablelocalroot=mw.html.create('table')root:addClass('wikitable'):addClass('sortable'):addClass('alternance'):addClass('collapsible')-- :addClass('collapsed'):css('font-size','95%')-- add the header rowlocalrow=root:tag('tr')localcell=row:tag('th')cell:wikitext('Αεροπορική εταιρεία')cell=row:tag('th')cell:addClass('unsortable')cell:wikitext('Προορισμός')if(isnotempty(args['3ecoltitre']))thencell=row:tag('th')cell:css('width','10%')cell:wikitext(args['3ecoltitre'])end-- loop over rowsforj=1,rowsdorow=root:tag('tr')fori=1,colsdocell=row:tag('td')if(i>2)thencell:css('text-align','center')endcell:wikitext(args[cols*(j-1)+i]or'')endend-- return the root tablereturntostring(root)endreturnp