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...»
 
Sin resumen de edición
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
   
   
Línea 11: Línea 11:
   
   
         if entity == nil then
         if entity == nil then
           return "(no item connected)"
           return "(página no conectada a ítem de Wikidata)"
         end
         end
   
   
Línea 17: Línea 17:
end
end
   
   
-- Return the label of a given data item.
-- Devuelva la etiqueta de un ítem dado.
function p.label(frame)
function p.label(frame)
         if frame.args[1] == nil then
         if frame.args[1] == nil then
Línea 31: Línea 31:
end
end
   
   
-- Return the local page about a given data item.
-- Devuelve la página local de un ítem dado.
function p.page(frame)
function p.page(frame)
         if frame.args[1] == nil then
         if frame.args[1] == nil then

Revisión del 16:19 1 may 2013

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 "(página no conectada a ítem de Wikidata)"
        end
 
        return entity.id
end
 
-- Devuelva la etiqueta de un ítem dado.
function p.label(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.page(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