Module:IBox

local p = {}

-- Generates a single row function p.row(frame) local args = frame:getParent.args if args.condition ==  then return  end

local tr	if args.class then tr = '' else tr = " " end

local th = mw.html.create('th'):wikitext(args[1]) if args.labelclass then th:addClass(args.labelclass) end

local td = mw.html.create('td'):wikitext(args[2] or args.default) if args.valueclass then td:addClass(args.valueclass) end

return tr..tostring(th)..tostring(td)..' ' end

-- Generates a header function p.header(frame) local args = frame:getParent.args if args.condition ==  then return  end local tr = mw.html.create('tr') :tag('th') :attr('colspan', 2):addClass('mainheader') :wikitext(args[1]):done return tostring(tr) end

-- Generates the ending part function p.ending(frame) local args = frame:getParent.args if args.mode == 'infotable' then return ' ' else return ' ' end end

function p.start(frame) local args = frame:getParent.args local mode = args.mode == 'infotable' and 'infotable' or 'infobox'

--CSS computations local css = mode..' box colored bordered innerbordered fill-td type-' if args.type then css = css..mw.text.split(args.type, " ")[1] else css = css..'basic'end if not args.bullets == 'on' then css = css..' no-icon' end if args.float == 'left' then css = css..' float-left-clear' else css = css..' float-right-clear' end css = css..' '..(args.class or '') --Start the box local page = tostring(mw.title.getCurrentTitle) local text = ' ' if mode == 'infotable' then text = 'blah' else	--Infobox

if args.editlink then text = text..' ['.. tostring(mw.uri.fullUrl(args.editlink..':'..page,'action=formedit')).. ' edit] ' end

text = text..(args[1] or page)..(args.ref or '')..' '

if args['image name'] then text = text..' '.. frame:expandTemplate{ title = 'IBox/ImageFormat', args = { args['image name'], size = args['image size'], caption = args['image caption'] } }..' '		elseif args.image then text = text..args.image..'  ' end

if args.subtitle then text = text..' '.. args.subtitle..' ' end end return text end return p