Module:Renewable resource row

local p = {} p.row = function( f ) local args = f	if f == mw.getCurrentFrame then args = f:getParent.args 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			resources = grid.getParts( v ).name if resources:find( '^Any ' ) then table.insert( titles,  .. resources:sub( 4 ) ..  ) else table.insert( titles,  .. resources ..  ) end end title = table.concat( titles, ', ' ):gsub( ',([^,]-)$', ' and%1') 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, '| 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, '| 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