Module:Sandbox/Aidan9382/DiscussionOverview
Appearance
Examples
Section | Initiator | Last Comment | Size | Participants |
---|---|---|---|---|
Thanks | AHHHHHHHHH | |||
ArbCom 2023 Elections voter message | AHHHHHHHHH | |||
Thanks | AHHHHHHHHH | |||
Invitation | AHHHHHHHHH | |||
Module goodness | AHHHHHHHHH | |||
Template:CFB Team Depth Chart | AHHHHHHHHH | |||
Archive Bot | AHHHHHHHHH | |||
Thank you | AHHHHHHHHH | |||
Aidan9382-Bot: Monitoring page moves failure (Fixed) | AHHHHHHHHH | |||
Aidan9382-Bot: Monitoring page moves failure (Fixed) | AHHHHHHHHH | |||
Help with regex | AHHHHHHHHH | |||
ArbCom 2024 Elections voter message | AHHHHHHHHH | |||
Need Help with Module:Template parameter value | AHHHHHHHHH | |||
Aidan9382-Bot: Monitoring page moves failure (Fixed) | AHHHHHHHHH | |||
Aidan9382-Bot: Monitoring page moves failure (Fixed) | AHHHHHHHHH | |||
Aidan9382-Bot: Monitoring page moves failure (Fixed) | AHHHHHHHHH | |||
Aidan9382-Bot: Monitoring page moves failure (Fixed) | AHHHHHHHHH | |||
Aidan9382-Bot: Monitoring page moves failure (Fixed) | AHHHHHHHHH |
--[[
Ill rewrite this soon
just lost like a lot of progress cause i fat fingered a wikilink so im gonna be pushing changes much more now
--]]
local Transcluder = require("Module:Transcluder")
local p = {}
local function getSectionData(text)
local sections = {}
text = "\n"..text.."\n== "
while true do
local section,content = string.match(text,"\n==%s*([^=]-)%s*==\n(.-)\n==[^=]")
if not section then
break
end
text = string.sub(text,string.find(text,content,1,true)+#content,-1)
sections[#sections+1] = {name=section,content=content}
end
return sections
end
function p.main(frame)
local page = frame.args[1] or frame.args.page
assert(type(page)=="string","Invalid or no page provided")
local success,text = pcall(Transcluder.get,page)
assert(success,text)
local sections = getSectionData(text)
local tableContent = '{| class="wikitable sortable"\n! Section !! Initiator !! Last Comment !! Size !! Participants'
for _,section in next,sections do
local sanitisedName = string.gsub(string.gsub(section.name,"%[%[:?[^|]-|([^%]]-)]]","%1"),"%[%[:?([^%]]-)]]","%1")
local wikilinkAnchor = "[[:"..page.."#"..sanitisedName.."|"..sanitisedName.."]]"
local sectionContent = "\n|-\n| "..wikilinkAnchor.." || AHHHHHHHHH"
tableContent = tableContent .. sectionContent
end
return tableContent .. "\n|}"
end
function p.maindev(frame)
local content = p.main(frame)
return content .. "\n\n" .. frame:extensionTag("syntaxhighlight",content,{lang="html5"})
end
return p