Diferencia entre revisiones de «Módulo:Wikibase»
Apariencia
m Protegió «Módulo:Wikibase»: recuperar protección ([Editar=Solo bibliotecarios] (indefinido) [Pueden trasladar=Solo bibliotecarios] (indefinido)) |
Actualización de funciones de Módulo:Wikibase, más específicamente desde esta versión |
||
| Línea 8: | Línea 8: | ||
end | end | ||
id = mw.wikibase.getEntityIdForCurrentPage() | |||
if | if id == nil then | ||
return "" | return "" | ||
end | end | ||
return | return id | ||
end | end | ||
| 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 | ||
label = mw.wikibase.getLabel() | |||
else | else | ||
label = mw.wikibase.getLabel(frame.args[1]) | |||
end | end | ||
return | return label | ||
end | end | ||
| Línea 34: | Línea 31: | ||
function p.enlace(frame) | function p.enlace(frame) | ||
if frame.args[1] == nil then | if frame.args[1] == nil then | ||
id = mw.wikibase.getEntityIdForCurrentPage() | |||
if not | if not id then return nil end | ||
else | else | ||
id = frame.args[1] | id = frame.args[1] | ||
end | end | ||
return mw.wikibase. | return mw.wikibase.getSitelink( id ) | ||
end | end | ||
| Línea 48: | Línea 43: | ||
function p.descripcion(frame) | function p.descripcion(frame) | ||
if frame.args[1] == nil then | if frame.args[1] == nil then | ||
desc = mw.wikibase.getDescription() | |||
else | else | ||
desc = mw.wikibase.getDescription(frame.args[1]) | |||
end | end | ||
return | return desc | ||
end | end | ||
return p | return p | ||
Revisión del 02:48 20 feb 2021
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
id = mw.wikibase.getEntityIdForCurrentPage()
if id == nil then
return ""
end
return id
end
-- Devuelve la etiqueta de un ítem dado.
function p.etiqueta(frame)
if frame.args[1] == nil then
label = mw.wikibase.getLabel()
else
label = mw.wikibase.getLabel(frame.args[1])
end
return label
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)
if frame.args[1] == nil then
desc = mw.wikibase.getDescription()
else
desc = mw.wikibase.getDescription(frame.args[1])
end
return desc
end
return p