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

From blackwiki
Jump to navigation Jump to search
blackwiki>Jts1882
(return the template code)
blackwiki>Jts1882
(this is confusing)
Line 5: Line 5:
  
 
function p.convert(frame)
 
function p.convert(frame)
args = frame.args
+
args = frame:getParent().args
 
local template = {}
 
local template = {}
 
local targs = {}
 
local targs = {}

Revision as of 15:11, 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:getParent().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