Module:Schematic

local p = {} function p.table( f ) local args = f.args if args[1] == nil then args = f:getParent.args end local caption = args.caption or '' local captionstyle = args.captionstyle or '' local clear = args.clear or '' local float = args.float or '' local size = tonumber( args.size ) or 32 local style = args.style or '' local tablestyle = args.tablestyle or '' local sprite = require( 'Module:SchematicSprite' ).sprite if size ~= 32 then tablestyle = 'font-size:' .. size .. 'px;' .. tablestyle end

local schematic = { '{| class="schematic2" style="' .. tablestyle .. '"' } local cols = 0 local maxcols = 0 for _, v in ipairs( args ) do		if mw.text.trim( v ) == '-' then table.insert( schematic, '|-' ) cols = 0 else v = mw.text.split( v, '+' ) v.table = true v.size = size table.insert( schematic, '| ' .. sprite( v ) ) cols = cols + 1 if cols > maxcols then maxcols = cols end end end table.insert( schematic, '|}' ) local out if caption ~=  or float ~=  then if float == '' then float = 'right' end if clear == '' then clear = 'none' end local captionwidth = maxcols * ( size + 1 ) - 5 if captionwidth < 182 then captionwidth = 182 end out = { ' ',				' ',					table.concat( schematic, '\n' ), ' ' .. caption .. ' ',				' ',			' '		}		out = table.concat( out, '\n' ) else out = table.concat( schematic, '\n' ) end out = out:gsub( ' style=""', '' ) return out end return p