Module:Wikibase

Hello, you have come here looking for the meaning of the word Module:Wikibase. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:Wikibase, but we will also tell you about its etymology, its characteristics and you will know how to say Module:Wikibase in singular and plural. Everything you need to know about the word Module:Wikibase you have here. The definition of the word Module:Wikibase will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:Wikibase, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


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

-- Return the entity ID of the item linked to the current page.
function p.id(frame)
	if not mw.wikibase then
		return "no mw.wikibase"
	end
	return mw.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.
function p.wdurl(frame)
	return mw.wikibase.getEntityUrl(frame.args and mw.text.trim(frame.args)) -- 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.
function p.label(frame)
	return mw.wikibase.getLabel(frame.args and mw.text.trim(frame.args)) -- 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.
function p.description(frame)
	return mw.wikibase.getDescription(frame.args and mw.text.trim(frame.args)) -- 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.
function p.page(frame)
	local qid = frame.args and mw.text.trim(frame.args)
	if not qid or qid == '' then
		qid = mw.wikibase.getEntityIdForCurrentPage() -- default the item connected to the current page
	end
	return mw.wikibase.getSitelink(qid or '') -- requires one string arg
end

-- Return the data type of a property given its entity ID.
function p.datatype(frame)
	local prop = mw.wikibase.getEntity(frame.args and mw.text.trim(frame.args):upper():gsub('PROPERTY:P', 'P')) -- trim and remove any "Property:" prefix
	return prop and prop.datatype
end

return p