Modulis:Smilšu kaste/Voll/NotInLVTable

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

local p = {}

function p.table(frame)
	resultTable = '{| class="wikitable" width=100%\n!title!!lv!!en!!ru!!de!!et!!lt!!pl!!wd\n|-'
	index = 1
	while frame.args[index] do
		Id = frame.args[index]
		index = index + 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
		resultTable = resultTable .. result1 .. result2 .. '\n| style="background:#cfc;"|[[d:' .. Id .. '|' .. Id .. ']]\n'
	end
	resultTable = resultTable .. '\n|}\n'
	return resultTable
end

return p