Модуль:WikidataTree/Taxon

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску
Документация
local p = {}

function p.itemString( frame, entityId, formatEntityId )
	-- local name = getProperty( frame, entityId, 'P225' )
	local link = formatEntityId( entityId )
	if ( not entityId ) then
		link = '\'\'\'' .. link .. '\'\'\''
	end
	
	local rank = getProperty( frame, {
		entityId = entityId,
		property = 'P105',
		novalue = '<span style="color:darkred">без ранга</span>'
	} )
	local classAttr = ''
	if ( mw.ustring.find( rank, 'без ранга', 0, true )
		or mw.ustring.find( rank, 'под', 0, true )
		or mw.ustring.find( rank, 'над', 0, true )
		or mw.ustring.find( rank, 'инфра', 0, true )
	) then
		classAttr = ' class="NavContent"'
	end
	local out = '<div' .. classAttr .. '>'
		.. '<table width="100%" cellpadding="0" cellspacing="0">'
		.. '<tr><td width="40%" align="right" valign="top">'
		.. rank .. ':&nbsp;'
		.. '</td><td width="60%" align="left">'
		.. link
		.. '</td></tr></table></div>'
	
	return out
end

return p