Module:Urldecode: Difference between revisions
Appearance
Content deleted Content added
Psiĥedelisto (talk | contribs) Initial version copied from https://en.wikinews.org/w/index.php?title=Module:Urldecode. See that page's history for attribution. |
Psiĥedelisto (talk | contribs) fix format requests that resolve to { or } |
||
Line 3: | Line 3: | ||
function p.urlDecode( frame ) |
function p.urlDecode( frame ) |
||
local enctype = frame.args[2] |
local enctype = frame.args[2] |
||
local ret = nil; |
|||
if (frame.args[2] ~= nil) then |
if (frame.args[2] ~= nil) then |
||
enctype = mw.ustring.upper(enctype) |
enctype = mw.ustring.upper(enctype) |
||
if ((enctype == "QUERY") or (enctype == "PATH") or (enctype == "WIKI")) then |
if ((enctype == "QUERY") or (enctype == "PATH") or (enctype == "WIKI")) then |
||
ret = mw.uri.decode(frame.args[1],frame.args[2]) |
|||
end |
end |
||
else |
|||
⚫ | |||
end |
end |
||
ret = string.gsub(ret, "{", "{") |
|||
⚫ | |||
ret = string.gsub(ret, "}", "}") |
|||
return ret |
|||
end |
end |
||
Revision as of 17:12, 30 June 2020
local p = {}
function p.urlDecode( frame )
local enctype = frame.args[2]
local ret = nil;
if (frame.args[2] ~= nil) then
enctype = mw.ustring.upper(enctype)
if ((enctype == "QUERY") or (enctype == "PATH") or (enctype == "WIKI")) then
ret = mw.uri.decode(frame.args[1],frame.args[2])
end
else
ret = mw.uri.decode(frame.args[1])
end
ret = string.gsub(ret, "{", "{")
ret = string.gsub(ret, "}", "}")
return ret
end
return p