Module:Create plant stub
require('strict')
local p = {}
local pargs = {}
local function firstToUpper(str)
return (str:gsub("^%l", string.upper))
end
local function getArgs (frame, args)
local parents = mw.getCurrentFrame():getParent()
for k,v in pairs(parents.args) do
--check content
if v and v ~= "" then
args[k]=v --parents.args[k]
end
end
for k,v in pairs(frame.args) do
--check content
if v and v ~= "" then
args[k]=v
end
end
end
p.main = function (frame)
getArgs(frame,pargs)
local genus = pargs['genus']
local species = pargs['species']
local common = pargs['common_name']
if not (genus and species) then
return "ERROR: require genus and species parameter"
end
local output = ""
local short = pargs['short'] or "Species of plant in the genus " ..pargs['genus']
output = output .. "{{short description|" .. short .. "}}"
--speciesbox
output = output .. "\n{{speciesbox"
output = output .. "\n|image = " .. pargs['image'] or ""
output = output .. "\n|genus = " .. genus .. "\n|species = " .. species
output = output .. "\n}}"
--lede
output = output .. "\n'''''" .. firstToUpper(genus) .. " " .. species .. "'''''"
if common then
output = output .. ", also called the '''" .. common .. "''',"
end
output = output .. " is a species of " .. pargs['type'] or "flowering plant" .. "in the genus ''[[" ..genus "]]''"
if pargs['distribution'] then
output = output .. ", native to " .. pargs['distribution']
end
output = output .. ". " .. (pargs['comment'] or "")
-- subtaxa --
local subtaxa = pargs['subtaxa']
if subtaxa then
output = output .. "\n==Subtaxa==" .. "\nThe following subtaxa are recognised:\n"
frame.args[1] = subtaxa
frame.args['nolink'] = true -- subspecies shouldn't be linked
output = output .. require('Module:FishRef/utilities').format_species_list(frame)
--output = output ..
end
-- end stuff
output = output .. "\n==References=="
output = output .. "\n{{reflist}}"
output = output .. "\n\n{{taxonbar|from1=" .. (pargs['taxonbar'] or "") .. "}}"
output = output .. "\n" .. pargs['categories'] or ""
return output
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.