Jump to content

Module:Sandbox/Amire80-CEE1

From Wikipedia, the free encyclopedia
-- Testing something for the CEE 2020 conference

local p = {}

function p.main(frame)
	return('hello CEE')
end

function p.is_leap(frame)
	year = frame.args[1]
	year_num = tonumber(year)
	if ((year_num % 4) == 0) and ((year_num % 200) ~= 0) then
		return 'leap'
	else
		return 'not leap'
	end
end

function p.get_social_networks(frame)
	item = frame.args[1]
	instagram_p = 'P2003'
	youtube_p = 'P2397'
	entity = mw.wikibase.getEntity( item )
	
	instagram_v = mw.wikibase.getBestStatements( item, instagram_p )
	youtube_v = mw.wikibase.getBestStatements( item, youtube_p )
	
	return "instagram: " .. instagram_v[1].mainsnak.datavalue.value .. " | youtube: " .. youtube_v[1].mainsnak.datavalue.value
end

return p;