Diferencia entre revisiones de «Módulo:Formato texto»

De Hispanopedia
Sin resumen de edición
función para enlazar
Línea 41: Línea 41:
return table.concat(copia, ', ')
return table.concat(copia, ', ')
end
function z.enlazar(enlace, texto, calificativo)
local resultado
if enlace and texto then
resultado = '[[' .. enlace .. '|' .. texto .. ']]'
elseif enlace then
resultado = '[[' .. enlace .. ']]'
else
resultado = texto
end
if resultado and calificativo then
return resultado .. ' <small>(' .. calificativo .. ')</small>'
else
return resultado
end
end
end


return z
return z

Revisión del 13:05 13 dic 2015

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

local z = {}

function z.entreComillas(texto, ref)
	if ref and texto then
		return '«' .. texto .. '»' .. ref
	elseif texto then
	    return '«' .. texto .. '»'
	end
end

function z.entreParentesis(texto, calificativo)
	if texto and calificativo then
	    return texto .. ' (' .. calificativo .. ')'
	else
		return texto
	end
end

function z.enCursivas(texto, ref)
	if ref and texto then
		return '<i>' .. texto .. '</i>' .. ref
	elseif texto then
	    return '<i>' .. texto .. '</i>'
	end
end

function z.enVersalitas(texto)
	return texto and '<span style="font-variant:small-caps">' .. texto .. '</span>'
end

function z.enVariasLineas(lista)
	local copia={}
	require('Módulo:Tablas').insertarElementosConValor(lista, copia)
	
	return table.concat(copia, '<br/>')
end

function z.separadosPorComa(lista)
	local copia={}
	require('Módulo:Tablas').insertarElementosConValor(lista, copia)
	
	return table.concat(copia, ', ')
end

function z.enlazar(enlace, texto, calificativo)
	local resultado 
	
	if enlace and texto then
		resultado = '[[' .. enlace .. '|' .. texto .. ']]'
	elseif enlace then
		resultado = '[[' .. enlace .. ']]'
	else
		resultado = texto
	end
	
	if resultado and calificativo then
		return resultado .. ' <small>(' .. calificativo .. ')</small>'
	else
		return resultado
	end
end

return z