Ir al contenido

Módulo:Ficha de proyectos hermanos

De Wikiviajes, la guía libre de viajes

[editar] [purgar]

Documentación del módulo

Uso

Este módulo es una implementación de la plantilla {{Proyectos hermanos}}. No debe ser insertado directamente en los artículos.
Esta documentación es transcluida desde Módulo:Ficha de proyectos hermanos/doc.
Los editores pueden experimentar en la zona de pruebas de la plantilla.
Por favor, añade las categorías a la subpágina de documentación. Subpáginas de esta plantilla.

local p = {}
 
p.getWikipediaLink = function(frame)
    local entity = mw.wikibase.getEntity()
    if entity ~= nil and entity.sitelinks ~= nil and entity.sitelinks['eswiki'] ~= nil and entity.sitelinks['eswiki']['title'] ~= nil then
        return entity.sitelinks['eswiki']['title']
    else
        return ""
    end
end
 
p.getWikiquoteLink = function(frame)
    local entity = mw.wikibase.getEntity()
    if entity ~= nil and entity.sitelinks ~= nil and entity.sitelinks['eswikiquote'] ~= nil and entity.sitelinks['eswikiquote']['title'] ~= nil then
        return entity.sitelinks['eswikiquote']['title']
    else
        return ""
    end
end

p.getCommonsCat = function(frame)
    local entity = mw.wikibase.getEntity()
    if entity ~= nil and entity.claims ~= nil and entity.claims['p373'] ~= nil then
        return entity.claims['p373'][0].mainsnak.datavalue.value
    else
        return ""
    end
end
 
p.getDMOZLink = function(frame)
    local entity = mw.wikibase.getEntity()
    if entity ~= nil and entity.claims ~= nil and entity.claims['p998'] ~= nil then
        return entity.claims['p998'][0].mainsnak.datavalue.value
    else
        return ""
    end
end
 
_=[[
Función de apoyo para buscar errores
 
function dump(o)
	if type(o) == 'table' then
		local s = '{ '
		for k,v in pairs(o) do
			if type(k) ~= 'number' then k = '"'..k..'"' end
			s = s .. '['..k..'] = ' .. dump(v) .. ','
		end
		return s .. '} '
	else
		return tostring(o)
	end
end
]]
 
return p