imported>Zache
No edit summary
 
(No difference)

Latest revision as of 18:42, 3 October 2020

Documentation for this module may be created at Module:Sandbox/zache/doc

local p = {}

function p.is_leapyear(frame)
	year = frame.args[1]
	return frame:callParserFunction{ name = '#time', args = { 'L' , year } }
end

function p.get_social_networks(frame)
	local item = frame.args[1] or frame.args.item or "";
	
	local entity =  mw.wikibase.getEntityObject(item);
	local targetproperties={"P2002", "P2037", "P2397"}
	local out={}
	for n, property in pairs(targetproperties) do
		if (entity.claims[property]) then
			for p, claim in pairs(entity.claims[property]) do
				if claim["mainsnak"]["datatype"]~="wikibase-item" then
					out[property]=claim["mainsnak"]["datavalue"]["value"]			
				end
			end
		end
	end
	return mw.text.jsonEncode(out)
end

return p