Module:Sandbox/RexxS/Images
< Module:Sandbox | RexxS
![]() | This module is rated as pre-alpha. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure. |
Usage
{{#invoke:Sandbox/RexxS/Images|getImage}}
Returns a list of the corresponding images from Wikidata or "Noimage.svg" if none exist
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