Module:ListSubpages

local p = {} --p stands for package

function p.list( frame ) local page = frame.args[1] or frame.args['page'] or frame:callParserFunction('TOPLEVELPAGE') page = frame:callParserFunction('TOPLEVELPAGE', {page}) local allSubpages = frame:callParserFunction('SUBPAGES', { page, sep = "|" }) allSubpages = mw.text.split(allSubpages, "|") result = {} -- add main page result[#result+1] = [==[ Main ]==] if #allSubpages[1] > 0 then for i = 1, #allSubpages do		result[#result+1] = [==[ ]==]		result[#result+1] = string.sub( allSubpages[i], #page+2 )		result[#result+1] = ' ' end end

return table.concat(result)

end

return p