Module:Renewable resource row

local p = {} p.row = function( f ) local args = f	if f == mw.getCurrentFrame then args = f:getParent.args else f = mw.getCurrentFrame end local resource = mw.text.trim( args[1] or '' ) local product = mw.text.trim( args[2] or '' ) local grid = require( 'Module:Grid' ) local output = {}

local title if args.title or  ~=  then title = args.title else local titles = {} for v in mw.text.gsplit( resource, '%s*,%s*' ) do			local resources = grid.getParts( v ).name:gsub( '^Any ', '' ) table.insert( titles,  .. resources ..  ) end title = mw.text.listToText( titles ) end

local icon = function( var ) local out = {} for icons in mw.text.gsplit( var, '%s*,%s*' ) do			table.insert( out, grid.cell{ icons, class = 'plain' } ) end return table.concat( out ) end

local resourceicon if resource ~= '' then resourceicon = ' ' .. icon( resource ) else resourceicon = '' end

table.insert( output, '| style="text-align:center" | ' .. title .. resourceicon )

local align = 'center' if f:callParserFunction( '#var', 'renewable-method' ) ~= '' then align = 'left' end

local products if args.product or  ~=  then products = args.product elseif product ~= '' then products = icon( product ) else products = '—' end

table.insert( output, '| style="text-align:' .. align .. '" | ' .. products )

if f:callParserFunction( '#var', 'renewable-method' ) == '' then table.insert( output, '| ' .. ( args[3] or '' ) ) end

table.insert( output, '|-' )

return table.concat( output, '\n' ) end return p