Modulis:Smilšu kaste/Voll/NotInLV

Dokumentācijas ikona Moduļa dokumentācija[izveidot]
local langTable = { 'lv','en','ru','de','et','lt','pl', }

local p = {}

function p.link(frame)
	Id = frame.args[1]
	local entity = mw.wikibase.getEntityObject(Id)
	if not entity or not entity.sitelinks then
		return ''
	end
	Label = entity:getLabel( 'en' )
	if not Label then
		Label = ''
	end
    result2 = ''
    for langCount = 1, 7 do
	   	local sitelink = entity:getSitelink( langTable[langCount] .. 'wiki' )
		if sitelink then
			result2 = result2 .. '\n| style="background:#cfc;"|' .. '[[:w' .. ':' .. langTable[langCount] .. ':' .. sitelink .. '| +]]'
			if Label == '' then
				Label = sitelink
			end
		else
			result2 = result2 .. '\n| -'
		end
	end
    result1 = '|-\n|' .. Label
	result = result1 .. result2 .. '\n| style="background:#cfc;"|[[d:' .. Id .. '|' .. Id .. ']]\n'
	return result
end

return p