Diferencia entre revisiones de «Módulo:URL»
Ir a la navegación
Ir a la búsqueda
m
Cambió la configuración de protección de «Módulo:URL»: Módulo o plantilla muy utilizado/sensible ([Editar=Permitir solo editores de plantillas y administradores] (indefinido))
m (1 revisión importada) |
La Sirenita (película de 2023)>LuchoCR m (Cambió la configuración de protección de «Módulo:URL»: Módulo o plantilla muy utilizado/sensible ([Editar=Permitir solo editores de plantillas y administradores] (indefinido))) |
||
Línea 1: | Línea 1: | ||
local z = {} | |||
function z.enlazar(url, texto) | |||
--if true then return 'url: ' .. (url or '') .. ' texto: ' .. (texto or '') end | |||
if not url or | |||
url:match('^%s*$') then | |||
return | return | ||
elseif url:find('%[') or | |||
url:match('^{{{.*}}}$') then -- Por ejemplo, un parámetro de una plantilla, {{{página web|}}} | |||
return url | |||
elseif z.esValida(url) then | |||
urlCorregida = url | |||
else | |||
urlCorregida = 'http://' .. url | |||
end | end | ||
if texto then | |||
return '[' .. urlCorregida .. ' ' .. texto .. ']' | |||
else | |||
textoCorregido = urlCorregida:match('^http://(.+)') or | |||
urlCorregida:match('^https://(.+)') or | |||
urlCorregida | |||
-- Eliminar la / al final | |||
textoCorregido = textoCorregido:match('(.+)/$') or textoCorregido | |||
return '[' .. urlCorregida .. ' ' .. textoCorregido .. ']' | |||
end | end | ||
end | end | ||
function | function z.url(frame) | ||
if not frame or not frame.args then | |||
return | |||
if | |||
end | end | ||
return | return z.enlazar(frame.args[1], frame.args[2]) | ||
end | end | ||
-- | --function z.enlacePlano | ||
-- Ver la plantilla Enlace plano | |||
-- | -- return | ||
--end | |||
end | |||
-- | -- Ver la función checkurl del módulo de citas. | ||
function z.esValida(url) | |||
return url:sub(1,2) == "//" or url:match( "^[^/]*:" ) | |||
function | |||
end | end | ||
return | return z |