Op den Inhalt sprangen

Modul:Wikibase

Vu Wikipedia

D'Dokumentatioun fir dëse Modul kann opModul:Wikibase/docugeluecht ginn

---------- Module:Wikibase ----------------
require('strict')
localp={}

-- Return the entity ID of the item linked to the current page.
functionp.id(frame)
ifnotmw.wikibasethen
return"no mw.wikibase"
end
returnmw.wikibase.getEntityIdForCurrentPage()or"no entity"
end

-- Return the URL of an entity given its entity ID
-- or the item linked to the current page if no argument is provided.
functionp.wdurl(frame)
returnmw.wikibase.getEntityUrl(frame.args[1]andmw.text.trim(frame.args[1]))-- defaults to entity URL of the item linked to the current page
end

-- Return the label of an entity given its entity ID
-- or the item linked to the current page if no argument is provided.
functionp.label(frame)
returnmw.wikibase.getLabel(frame.args[1]andmw.text.trim(frame.args[1]))-- defaults to label of the item linked to the current page
end

-- Return the description of an entity given its entity ID
-- or the item linked to the current page if no argument is provided.
functionp.description(frame)
returnmw.wikibase.getDescription(frame.args[1]andmw.text.trim(frame.args[1]))-- defaults to description of the item linked to the current page
end

-- Return the local title of an item given its entity ID
-- or the item linked to the current page if no argument is provided.
functionp.page(frame)
localqid=frame.args[1]andmw.text.trim(frame.args[1])
ifnotqidorqid==''then
qid=mw.wikibase.getEntityIdForCurrentPage()-- default the item connected to the current page
end
returnmw.wikibase.getSitelink(qidor'')-- requires one string arg
end

-- Return the data type of a property given its entity ID.
functionp.datatype(frame)
localprop=mw.wikibase.getEntity(frame.args[1]andmw.text.trim(frame.args[1]):upper():gsub('PROPERTY:P','P'))-- trim and remove any "Property:" prefix
returnpropandprop.datatype
end

returnp