For faster navigation, this Iframe is preloading the Wikiwand page for Módulo:URL.

Módulo:URL

Uso

Este módulo proporciona operaciones sobre URL.

Funciones

url

Formatea una url añadiéndole el texto especificado. Sintaxis:

((#Invoke:URL|url|<url>|<texto>))
Ejemplos
  • ((#Invoke:URL|url|www.ejemplo.com|Sitio web oficial))Sitio web oficial
  • ((#Invoke:URL|url|http://www.ejemplo.coml))www.ejemplo.com
  • ((#Invoke:URL|url|[http://www.ejemplo.com Ejemplo]|Sitio web oficial))Ejemplo
  • ((#Invoke:URL|url||Sitio web oficial))
Notas

Para llamar a la función desde LUA puede utilizarse en su lugar la función enlazar:

enlazar(<url>, <texto>)

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
	elseif url:find('%[') or 
		url:match('^&#123;&#123;&#123;.*&#125;&#125;&#125;$') 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
	
	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

function z.url(frame)
	if not frame or not frame.args then
		return
	end
	
	return z.enlazar(frame.args[1], frame.args[2])
end

--function z.enlacePlano
	-- Ver la plantilla Enlace plano
--	return
--end

-- Ver la función checkurl del módulo de citas.
function z.esValida(url)
	return url:sub(1,2) == "//" or url:match( "^[^/]*:" )
end

return z
{{bottomLinkPreText}} {{bottomLinkText}}
Módulo:URL
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?