Jump to content

Module:Wikibase

Kusuka e Wikipedia

Documentation for this module may be created atModule:Wikibase/doc

-- Module:Wikibase
localp={}

-- Return the item ID of the item linked to the current page.
functionp.id(frame)
entity=mw.wikibase.getEntityObject()
ifentity==nilthen
return"ezer ere ez"
end
returnentity.id
end

-- Return the label of a given data item.
functionp.label(frame)
ifframe.args[1]==nilthen
entity=mw.wikibase.getEntityObject()
ifnotentitythenreturnnilend
id=entity.id
else
id=frame.args[1]
end
returnmw.wikibase.label(id)
end

-- Return the local page about a given data item.
functionp.page(frame)
ifframe.args[1]==nilthen
entity=mw.wikibase.getEntityObject()
ifnotentitythenreturnnilend
id=entity.id
else
id=frame.args[1]
end
returnmw.wikibase.sitelink(id)
end

-- Return the first value of given property of the item linked to the current page.
functionp.firstproperty(frame)
localproperty=frame.args[1]
localentity=mw.wikibase.getEntityObject()
ifnotentitythenreturnnilend
ifnotentity.claimsthenreturnnilend
localhasProp=entity.claims[property]
ifnothasPropthenreturnnilend
returnhasProp[0].mainsnak.datavalue.value
end

returnp