Module:URLEncode: Difference between revisions

From The Joe Frank Wiki
for dynamic infobox
 
a
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


function p.encode(frame)
function p.encode(frame)
     local str = frame.args[1] or ''
    -- Retrieve the current page title directly
     return mw.uri.encode(str, 'PATH')
     local title = mw.title.getCurrentTitle().text
    -- Perform URL encoding
     return mw.uri.encode(title, 'PATH')
end
end


return p
return p

Latest revision as of 07:08, 27 October 2024

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

local p = {}

function p.encode(frame)
    -- Retrieve the current page title directly
    local title = mw.title.getCurrentTitle().text
    -- Perform URL encoding
    return mw.uri.encode(title, 'PATH')
end

return p