לדלג לתוכן

יחידה:תבנית מידע/בעל חיים

מתוך ויקיפדיה, האנציקלופדיה החופשית

ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:תבנית מידע/בעל חיים/תיעוד

local Infobox = require('Module:תבנית מידע').Infobox
local HumanInfobox = require('Module:תבנית מידע/אישיות')

function birthLabelTerm(frame)
	local label =  'לידה'
	local templateArgs = frame:getParent().args
	local taxon = templateArgs['מין']
	if taxon == '' or taxon == nil then return label end
	if mw.ustring.find(taxon, 'תנין')~=nil or mw.ustring.find(taxon, 'אליגטור')~=nil then
		label = 'בקיעה'
	elseif mw.ustring.find(taxon, 'פיל')~=nil then
		label = 'המלטה'
	end
	
	return label
end

function infobox(frame)
	local infoObj = Infobox:new()
	local templateArgs = frame:getParent().args
	local birthLabel = templateArgs['כיתוב לידה'] or birthLabelTerm(frame)
	local deathLabel = 'מוות'
	infoObj:parseArgs(frame)
	
	if infoObj.args.title ~= '-' then
		-- TODO: consider to override addMissingImage with animal
		HumanInfobox.addPersonDetails(frame, infoObj)

		for k,v in pairs(infoObj.templateStructure) do
			if v['label'] == 'לידה' then
				v['label'] = birthLabel
			end
			if v['label'] == 'פטירה' then
				v['label'] = deathLabel
			end
		end
	end
	
	return infoObj:render()
end

return 	{
	['מידע']=infobox
}