Module:BASICPAGENAME

From Wikivoyage
Jump to navigation Jump to search

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

local i = {}

function i.BASICPAGENAME(frame)
    local basicpagename = frame:getParent().args[1] or '';
    if basicpagename == '' then
        basicpagename = mw.title.getCurrentTitle().subpageText;
    end

    basicpagename = mw.ustring.gsub(basicpagename, '%s%(.*%)', '');
    basicpagename = mw.ustring.gsub(basicpagename, '.*%/', '');

    return basicpagename;
end

return i;