Module:Subpages 3: Difference between revisions

Undo revision 2020934 by Robkelk (talk)
No edit summary
(Undo revision 2020934 by Robkelk (talk))
Tag: Undo
 
(7 intermediate revisions by 2 users not shown)
Line 9:
"Analysis", "Characters", "Laconic", "Recap", "Trivia", "Setting", "YMMV",
"Fridge", "Fanfic Recs", "Haiku", "Headscratchers", "Ho Yay", "Image Links",
"Memes", "Radar", "Quotes", "Reviews", "Source", "Useful Notes", "WMG"
},
["creator"] = {"YMMV", "Quotes", "Fanfic Recs", "Analysis", "Trivia", "WMG", "Image Links", "Haiku", "Laconic"}
Line 53:
if template == "index" then
template = "trope"
crowners["trope"] = {}
mainpage = ":" .. page
page = page:gsub("Category:", "", 1)
Line 142 ⟶ 143:
return "; [["..page.."]]\n" .. build_list( tree, page..'/', 1 )
end
 
 
function build_tree ( page, subpage_list )
Line 153 ⟶ 155:
for i, dir in ipairs(list) do
if lastdir[dir] == nil then lastdir[dir] = { } end
lastdir = lastdir[dir]
end
Line 164 ⟶ 166:
local ul = {}
 
for page, branch in pairs(tree) do
local ordered_sp = {}
for page, branch in pairs(tree) do
insert(ordered_sp, page)
end
table.sort(ordered_sp)
 
for i = 1, #ordered_sp do
local page = ordered_sp[i]
local branch = tree[page]
local li