Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Biota infobox/test
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
require('strict') 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 value = value:gsub("%'",""):gsub("%[",""):gsub("%]","") --value='Hypsiboas' elseif param == 'species' then --value = value:gsub("[%'%[%]]","") value = value:gsub("[%'%[]*[A-Za-z%.]* ([A-Za-z]*)[%]%']*","%1") --value='albopunctatus' elseif param == 'binomial_authority' then param = 'authority' args['binomial_authority']=nil end table.insert (template, ' | ' .. param .. ' = ' .. value ); args[param]=nil -- remove handled parameters 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('image') p.addParam('status') p.addParam('status_system') p.addParam('status_ref') p.addParam('genus') p.addParam('species') p.addParam('binomial_authority') 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
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Biota infobox/test/doc
(
edit
)