Module:URLEncode: Difference between revisions

From The Joe Frank Wiki
for dynamic infobox
 
s/r in function
Line 3: Line 3:
function p.encode(frame)
function p.encode(frame)
     local str = frame.args[1] or ''
     local str = frame.args[1] or ''
    -- Decode any HTML entities back to their original characters
    str = mw.text.decode(str)
    -- Perform URL encoding
     return mw.uri.encode(str, 'PATH')
     return mw.uri.encode(str, 'PATH')
end
end


return p
return p

Revision as of 08:06, 27 October 2024

Documentation for this module may be created at Module:URLEncode/doc

local p = {}

function p.encode(frame)
    local str = frame.args[1] or ''
    -- Decode any HTML entities back to their original characters
    str = mw.text.decode(str)
    -- Perform URL encoding
    return mw.uri.encode(str, 'PATH')
end

return p