Difference between revisions of "Module:Biota infobox/test"

From blackwiki
Jump to navigation Jump to search
blackwiki>Jts1882
(next step)
blackwiki>Jts1882
(return the template code)
Line 28: Line 28:
 
table.insert (template, '}}'); -- close the template
 
table.insert (template, '}}'); -- close the template
 
 
return frame:expandTemplate{ title = 'speciesbox', args = targs }
+
--return frame:expandTemplate{ title = 'speciesbox', args = targs }
--return table.concat (template, '\n');
+
return table.concat (template, '\n');
 
end
 
end
  
 
return p
 
return p

Revision as of 15:05, 28 January 2020

Documentation for this module may be created at Module:Biota infobox/test/doc

require('Module:No globals')

local p = {}  -- exposed variables
local args = {}  

function p.convert(frame)
	args = frame.args
	local template = {}
	local targs = {}
	
	table.insert (template, '{{speciesbox ' );	
	
	
	for k,v in pairs(args) do
		
		if k == 'genus' then 
			local param = k:gsub("%'",""):gsub("%[",""):gsub("%]","")
			k=param
			v='Hypsiboas'
		elseif k== 'species' then
			v='albopunctatus'
		end
		
	    table.insert (template, table.concat ({' |'..k..'=', v}));	
	    targs[k]	= v
	end

	table.insert (template, '}}');												-- close the template
	
	--return frame:expandTemplate{ title = 'speciesbox', args = targs }
	return table.concat (template, '\n');			
end

return p