模組:Property
外观
-- Module:Wikibase
-- https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua
-- [[Template:Label]]
local p = {}
-- Return the data of a given data item.
function p.data(frame)
entity = mw.wikibase.getEntity(frame.args[2])
if not entity then return nil end
if frame.args[1] == nil then
return mw.wikibase.label(entity.id)
end
property = entity['claims'][frame.args[1]]['mainsnak']['datavalue']
-- assert: property['type'] == 'wikibase-entityid'
property = 'Q' + property['value']['numeric-id']
return property
end
return p