Ir al contenido

Diferencia entre revisiones de «Módulo:Wikibase»

Página creada con «-- Module:Wikibase local p = {} -- Return the item ID of the item linked to the current page. function p.id(frame) if not mw.wikibase then return "wiki...»
 
m 18 revisiones importadas
 
(No se muestran 19 ediciones intermedias de 9 usuarios)
Línea 2: Línea 2:
local p = {}
local p = {}
   
   
-- Return the item ID of the item linked to the current page.
-- Devuelve la ID del ítem, el nombre o el enlace de la página en la wiki local.
function p.id(frame)
function p.id(frame)
         if not mw.wikibase then
         if not mw.wikibase then
           return "wikibase module not found"
           return "módulo wikibase no encontrado"
         end
         end
   
   
         entity = mw.wikibase.getEntity()
         return mw.wikibase.getEntityIdForCurrentPage() or ''
end
        if entity == nil then
          return "(no item connected)"
        end
   
   
         return entity.id
-- Devuelve la etiqueta de un ítem dado.
function p.etiqueta(frame)
         return mw.wikibase.getLabel(frame.args[1])
end
end
   
   
-- Return the label of a given data item.
-- Devuelve la página local de un ítem dado.
function p.label(frame)
function p.enlace(frame)
         if frame.args[1] == nil then
         if frame.args[1] == nil then
             entity = mw.wikibase.getEntity()
             id = mw.wikibase.getEntityIdForCurrentPage()
             if not entity then return nil end
             if not id then return nil end
            id = entity.id
         else
         else
             id = frame.args[1]
             id = frame.args[1]
         end
         end
   
   
         return mw.wikibase.label( id )
         return mw.wikibase.getSitelink( id )
end
end
 
-- Return the local page about a given data item.
-- Devuelve la descripción de un ítem dado.
function p.page(frame)
function p.descripcion(frame)
        if frame.args[1] == nil then
return mw.wikibase.getDescription(frame.args[1])
            entity = mw.wikibase.getEntity()
            if not entity then return nil end
            id = entity.id
        else
            id = frame.args[1]
        end
        return mw.wikibase.sitelink( id )
end
end
   
   
return p
return p

Revisión actual - 11:05 1 abr 2025

La documentación para este módulo puede ser creada en Módulo:Wikibase/doc

-- Module:Wikibase
local p = {}
 
-- Devuelve la ID del ítem, el nombre o el enlace de la página en la wiki local.
function p.id(frame)
        if not mw.wikibase then
           return "módulo wikibase no encontrado"
        end
 
        return mw.wikibase.getEntityIdForCurrentPage() or ''
end
 
-- Devuelve la etiqueta de un ítem dado.
function p.etiqueta(frame)
        return mw.wikibase.getLabel(frame.args[1])
end
 
-- Devuelve la página local de un ítem dado.
function p.enlace(frame)
        if frame.args[1] == nil then
            id = mw.wikibase.getEntityIdForCurrentPage()
            if not id then return nil end
        else
            id = frame.args[1]
        end
 
        return mw.wikibase.getSitelink( id )
end

-- Devuelve la descripción de un ítem dado.
function p.descripcion(frame)
		return mw.wikibase.getDescription(frame.args[1])
end
 
return p