Modul:Wikidata2/sandkasse
Lua-feil i Modul:Documentation, linje 388: message: type error in message cfg.module-sandbox-category (string expected, got nil).
local p = {}
-- This is used to get a value like 'male' (for property p21) which won't be linked
p.getRawValue = function(frame)
if not mw.wikibase then
return ""
end
local propertyID = mw.text.trim(frame.args[1] or "")
local input_parm = mw.text.trim(frame.args[2] or "")
local table_separator = mw.text.trim(frame.args[3] or ",")
if input_parm == "hent_wikidata" then
local entity = tostring(mw.wikibase.getEntity())
if not entity then
return ""
end
if entity.claims[propertyID] ~= nil then
local out = {}
for k, v in pairs(entity.claims[propertyID]) do
if mw.wikibase.label(v.mainsnak.datavalue.value["numeric-id"]) then
out[#out + 1] = mw.wikibase.label(v.mainsnak.datavalue.value["numeric-id"])
else
return ""
end
end
return table.concat(out, table_separator .. ' ')
else
return ""
end
else
return input_parm
end
end
return p