Module:Sandbox
模块文档[创建]
您可能想要创建本的文档。 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模块的子页面。 |
--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