Module:Sandbox
跳到导航
跳到搜索
--Used by [[Template:IsPartOf]]
function suggest(pid)
if entity == nil then entity = mw.wikibase.getEntityObject() end
if entity == nil then return nil end
if entity.claims[pid] == nil then return nil end
local qid = entity.claims[pid][0].mainsnak.datavalue.value["numeric-id"]
local link = mw.wikibase.sitelink("Q" .. qid)
local title = tostring(mw.title.getCurrentTitle())
if link and link ~= title then return link else return nil end
end
local p = {}
function p.suggest(frame)
if frame:getParent().args[1] == nil or frame:getParent().args[1] == '' then
return suggest("p131") or suggest("p17") or suggest("p30") or ''
else
return frame:getParent().args[1]
end
end
return p