Edición de «Módulo:Formato texto»

Advertencia: no has iniciado sesión. Tu dirección IP se hará pública si haces cualquier edición. Si inicias sesión o creas una cuenta, tus ediciones se atribuirán a tu nombre de usuario, además de otros beneficios.

Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces publica los cambios para así efectuar la reversión.

Revisión actual Tu texto
Línea 78: Línea 78:
end
end


-- :: Generar un enlace
function z.enlazar(enlace, texto, calificativo)
function z.enlazar(enlace, texto, calificativo)
local resultado  
local resultado  
Línea 94: Línea 93:
else
else
return resultado
return resultado
end
end
-- Generar un enlace (implementación extendida)
function z.enlazar2(enlace, opciones)
if enlace then
local etiqueta, namespace, tamano, borde, enlace2, pieImagen, debeExistir, solotexto
if type(opciones) == 'table' then
etiqueta = opciones['etiqueta'] or ''
namespace = tonumber(opciones['namespace']) or 0
tamano = opciones['tamaño'] or '250px'
borde = opciones['border'] or opciones['borde']
enlace2 = opciones['link']
pieImagen = opciones['pie']
debeExistir = opciones['debe existir'] or opciones['debeExistir'] or opciones['debeexistir']
solotexto = opciones['solotexto']
elseif type(opciones) == 'string' then
etiqueta = opciones
elseif type(opciones) == 'number' then
namespace = opciones
else
etiqueta = enlace
namespace = 0
end
local tituloObj = mw.title.new(enlace, namespace) or {}
local titulo2Obj = {}
if enlace2 then titulo2Obj= mw.title.new(enlace2, 0) end
local resultado = {}
table.insert(resultado, tituloObj.fullText)
if not debeExistir and namespace ~= 6 and namespace ~= 14 then
if etiqueta then table.insert(resultado, etiqueta) end
if calificativo then return '[[' .. prefix .. table.concat(resultado, '|') .. ']]' .. ' <small>(' .. calificativo .. ')</small>' end
return '[[' .. table.concat(resultado, '|') .. ']]'
end
if tituloObj.exists or tituloObj.fileExists then
-- Archivo:
if namespace == 6 then
if solotexto then
if etiqueta then table.insert(resultado, etiqueta) end
return '[[:' .. table.concat(resultado, '|') .. ']]'
end
if tamano then table.insert(resultado, tamano) end
if borde then table.insert(resultado, 'border') end
if titulo2Obj.exists then table.insert(resultado, 'link=' .. titulo2Obj.fullText) end
if etiqueta then table.insert(resultado, etiqueta) end
if pieImagen then return '[[' .. table.concat(resultado, '|') .. ']]' .. '<br>' .. pieImagen end
return '[[' .. table.concat(resultado, '|') .. ']]'
end
-- Categoría:
if namespace == 14 then
if solotexto then
if etiqueta then table.insert(resultado, etiqueta) end
return '[[:' .. table.concat(resultado, '|') .. ']]'
end
return '[[' .. tituloObj.fullText .. ']]'
end
-- El resto
if etiqueta then table.insert(resultado, etiqueta) end
return '[[' .. table.concat(resultado, '|') .. ']]'
end
return etiqueta
end
end
end
end
Ten en cuenta que todas las contribuciones a Wiki TVenserio pueden ser editadas, modificadas o eliminadas por otros colaboradores. Si no deseas que las modifiquen sin limitaciones, no las publiques aquí.
Al mismo tiempo, asumimos que eres el autor de lo que escribiste, o lo copiaste de una fuente en el dominio público o con licencia libre (véase Wiki TVenserio:Derechos de autor para más detalles). ¡No uses textos con copyright sin permiso!
Cancelar Ayuda de edición (se abre en una ventana nueva)

Plantilla usada en esta página: