Module:Biota infobox/test
Appearance
require('Module:No globals')
local getArgs = require ('Module:Arguments').getArgs;
local p = {} -- exposed variables
--local pargs = {}
local template = {}
local args = {}
function p.addParam2(param,value)
--table.insert (template, table.concat ({' |'..param..'=', value})); -- this syntax works
--table.insert (template, table.concat ({' | '..param..' = ', value})); -- so does this (initial space needed)
--table.insert (template, table.concat ({'| '..param..' = ', value})); -- newline fails without initial space
end
function p.addParam(param)
if args[param] then
local value = args[param]
if param == 'genus' then
--local param = k:gsub("%'",""):gsub("%[",""):gsub("%]","")
--k=param
value='Hypsiboas'
elseif param == 'species' then
value='albopunctatus'
end
table.insert (template, ' | ' .. param .. ' = ' .. value );
end
end
function p.convert(frame)
--args = frame:getParent().args
args = getArgs (frame);
if args['genus'] and args['species'] then
table.insert (template, '{{Speciesbox' );
elseif args['taxon'] then
table.insert (template, '{{Automatic taxobox ' );
end
p.addParam('name')
p.addParam('genus')
p.addParam('species')
for k,v in pairs(args) do
table.insert (template, table.concat ({' |'..k..'=', v}));
end
table.insert (template, '}}'); -- close the template
return table.concat (template, '\n');
end
return p