Module:GetEventPageInfo

local subpages = mw.loadData('Module:SubpageSettings').tournaments.names local p = {}

function p.parseTitle(title) local titleparts = mw.text.split(title, '/') local event = {} local subpage = {} local parsed = {} for _,titlepart in ipairs(titleparts) do		if subpages[titlepart] then -- event is everything leading up to here event = subpage -- subpage will be the rest subpage = {[1] = titlepart} else -- just keep adding to whichever part we are in			subpage[#subpage+1] = titlepart end end -- case regular page if event[1] or subpages[titleparts[1]] then parsed.event = table.concat(event,'/') parsed.subpage = table.remove(subpage, 1) parsed.subsubpage = table.concat(subpage, '/') -- case overview page else parsed.event = table.concat(subpage, '/') parsed.subpage = '' parsed.subsubpage = '' end return parsed end

function p.getEventPageInfo(frame) local title = mw.title.getCurrentTitle.text local parsed = p.parseTitle(title) local subpage = parsed.subpage .. (parsed.subsubpage ~=  and '/' or ) .. parsed.subsubpage frame:callParserFunction{name='#vardefine:overviewpage', args={parsed.event} } frame:callParserFunction{name='#vardefine:subpage', args={subpage} } frame:callParserFunction{name='#vardefine:subpagetype', args={parsed.subpage} } end

return p