Ir al contenido

Diferencia entre revisiones de «Módulo:Wikibase»

Sin resumen de edición
Deshecha la edición 76474301 de Miguillen (disc.)
Línea 8: Línea 8:
         end
         end
   
   
         entity = mw.wikibase.getEntityObject()
         entity = mw.wikibase.getEntity()
   
   
         if entity == nil then
         if entity == nil then
Línea 20: Línea 20:
function p.etiqueta(frame)
function p.etiqueta(frame)
         if frame.args[1] == nil then
         if frame.args[1] == nil then
             entity = mw.wikibase.getEntityObject()
             entity = mw.wikibase.getEntity()
             if not entity then return nil end
             if not entity then return nil end
   
   
Línea 34: Línea 34:
function p.enlace(frame)
function p.enlace(frame)
         if frame.args[1] == nil then
         if frame.args[1] == nil then
             entity = mw.wikibase.getEntityObject()
             entity = mw.wikibase.getEntity()
             if not entity then return nil end
             if not entity then return nil end
   
   

Revisión del 21:04 20 ago 2014

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
 
        entity = mw.wikibase.getEntity()
 
        if entity == nil then
           return ""
        end
 
        return entity.id
end
 
-- Devuelve la etiqueta de un ítem dado.
function p.etiqueta(frame)
        if frame.args[1] == nil then
            entity = mw.wikibase.getEntity()
            if not entity then return nil end
 
            id = entity.id
        else
            id = frame.args[1]
        end
 
        return mw.wikibase.label( id )
end
 
-- Devuelve la página local de un ítem dado.
function p.enlace(frame)
        if frame.args[1] == nil then
            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
 
return p