Module:Sandbox/Ste1la/Wikidata

local p = {}

p.propertyCall = function(frame) local id = frame.args.id or "" local propertyId = frame.args.property or "" local articleName local link = "" local statementsTbl = mw.wikibase.getBestStatements(id, propertyId) local linkList = {} local out = "" if #statementsTbl == 0 then return "" end for k, v in pairs(statementsTbl) do		local id = v.mainsnak.datavalue.value.id

if mw.wikibase.getSitelink(id) then articleName = mw.wikibase.getSitelink(id) else articleName = mw.wikibase.getLabel(id) end if articleName:find("%(") then			i, j = articleName:find("%(") update = articleName:sub(1, i - 1) articleName = articleName .. "|" .. update end add = "" .. articleName .. "" table.insert(linkList, add) end out = table.concat(linkList, " ")

return out

end return p