Module:Sandbox/RexxS/Images

From Omniversalis

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

local p = {}
 
-- This is used to return an image filename from Wikidata (property p18), or "Noimage.svg" if none exists
p.getImage = function(frame)
	local ent = mw.wikibase.getEntityObject()
	local props = ent:formatPropertyValues('P18')
	local out = {}
	for k, v in pairs(props) do
		if k == 'value' then
			out[#out + 1] = v
		end
	end
	ret = table.concat(out, ", ")
	if #ret == 0 then
		ret = "Noimage.svg"
	end
	return ret
end

return p