Módulo:Wikibase

En Galifontes, o Wikisource en galego.
Indicacións de uso do módulo

Aínda non se redactaron as instrucións sobre como usar este módulo.
Engadir a explicación sobre o seu uso.

Os editores poden probar cambios no mesmo en Módulo:Wikibase/probas.
Por favor, engade as categorías na subpáxina de documentación e os interwikis no Wikidata. Ver as subpáxinas deste módulo.
-- Module:Wikibase
local p = {}

-- Devuelve a ID do ítem, o nome ou a ligazón da páxina na wiki local.
function p.id(frame)
	if not mw.wikibase then
		return "módulo wikibase non atopado"
	end

	entity = mw.wikibase.getEntityObject()

	if entity == nil then
		return ""
	end

	return entity.id
end

-- Devolve a etiqueta dun ítem dado.
function p.etiqueta(frame)
        if frame.args[1] == nil then
            entity = mw.wikibase.getEntityObject()
            if not entity then return nil end
 
            id = entity.id
        else
            id = frame.args[1]
        end
 
        return mw.wikibase.label( id )
end

-- Devolve a páxina local dun ítem dado.
function p.enlace(frame)
        if frame.args[1] == nil then
            entity = mw.wikibase.getEntityObject()
            if not entity then return nil end
 
            id = entity.id
        else
            id = frame.args[1]
        end
 
        return mw.wikibase.sitelink( id )
end

-- Devolve a descrición dun ítem dado.
function p.descricion(frame)
        if frame.args[1] == nil then
            entity = mw.wikibase.getEntityObject()
            if not entity then return nil end
 
            id = entity.id
        else
            id = frame.args[1]
        end
 
        return mw.wikibase.description( id )
end

return p