Módulo:Urldecode
Apariencia
Este módulo no tiene página de documentación[crear]
-- This function allows to translate the percent-encoding of web links and texts
local z = {}
function z.decode(frame)
local text = frame.args[1]
local enctype = frame.args[2]
local ret
if enctype then
enctype = mw.ustring.upper(enctype)
if enctype == "QUERY" or enctype == "PATH" or enctype == "WIKI" then
ret = mw.uri.decode(text, enctype)
else
ret = mw.uri.decode(text)
end
else
ret = mw.uri.decode(text)
end
ret = string.gsub(ret, "{", "{")
ret = string.gsub(ret, "}", "}")
return ret
end
function z.wikititle(frame)
local input = frame.args[1] or ""
local titulo = input:match("/wiki/([^%?#&]+)")
if not titulo then
titulo = input:match("title=([^&]+)")
end
if not titulo then
titulo = input
end
local decoded = mw.uri.decode(titulo)
decoded = decoded:gsub("_", " ")
decoded = decoded:gsub("{", "{")
decoded = decoded:gsub("}", "}")
return decoded
end
return z