Module:Sandbox/Sophiedp/ByMe

-- local p = {} local dpl = require('Module:Sandbox/Dorumin/DPL') local getArgs = require('Dev:Module:Arguments').getArgs

local function getSrc (page) if page == 'FixAceHighlightingUnits' then return '*' end local content if page == 'DarkGlobalNavDropdowns' then content = page .. '.css' elseif page == 'FixAceWidemode' then content = page .. '.css' elseif page == 'Responsive Mobile' then content = 'Responsive mobile.css' elseif page == 'PurgeButton' then content = 'PurgeButton/code.js' else content = page .. '.js' end return '(src)' end

local function getPages(cat, arg) local dpl_args if cat == 'other' then dpl_args = { namespace = '', createdby = 'Sophiedp', notcategory = { 'JavaScript/User tools', 'JavaScript/Page and file management', 'JavaScript/Site enhancements', 'JavaScript/Bug fixes', 'JavaScript/Site integration', 'JavaScript/Editing tools', 'JavaScript/User management', 'JavaScript/Talk tools', 'Chat Scripts', 'Discussions Scripts', 'CSS/User customizations', 'CSS/Editing customizations', 'CSS/Chat extensions' }       }    else dpl_args = { namespace = '', createdby = 'Sophiedp', category = cat }   end local query = dpl.list(dpl_args) local pages = {} if not arg then pages = { 'AvatarLink', 'PurgeButton', 'MinimalBanners', 'Responsive Mobile', 'FixAceHighlightingUnits' }   elseif arg == 'editing' then pages = { 'PurgeButton' }   elseif arg == 'user' then pages = { 'AvatarLink' }   elseif arg == 'other' then pages = { 'MinimalBanners', 'Responsive Mobile', 'FixAceHighlightingUnits' }   end local filter = { ['ResponsivePrivateList'] = 1, ['ShowHTMLComments'] = 1, ['Tabinsert'] = 1, ['JS Cookbook'] = 1 }   for _, page in ipairs(query) do        if not filter[page] then filter[page] = 1 table.insert(pages, page) end end table.sort(pages) return pages end

local function formatList(list, arg) if not next(list) then return else local wikitext = {} if arg then local header = arg:gsub("^%l", string.upper) if arg == 'fixes' then header = 'Bug Fixes' end table.insert(wikitext, '=== ') table.insert(wikitext, header) table.insert(wikitext, ' ===\n') end for _, page in ipairs(list) do           table.insert(wikitext, '* ')            table.insert(wikitext, page)            table.insert(wikitext, ' ') table.insert(wikitext, getSrc(page)) table.insert(wikitext, '\n') end return table.concat(wikitext) end end

function p.main(frame) local list = { user = 'JavaScript/User tools¦JavaScript/User management¦CSS/User customizations', management = 'JavaScript/Page and file management', site = 'JavaScript/Site enhancements', fixes = 'JavaScript/Bug fixes', integration = 'JavaScript/Site integration', editing = 'JavaScript/Editing tools¦CSS/Editing customizations', talk = 'JavaScript/Talk tools', chat = 'Chat Scripts¦CSS/Chat extensions', discussions = 'Discussions Scripts', other = 'other', [] =    }    local nameList = { 'user', 'management', 'site', 'fixes', 'integration', 'editing', 'talk', 'chat', 'discussions', 'other' }   local args = getArgs(frame) if args[1] == 'all' then local listAll = {} for _, item in ipairs(nameList) do           local pages = getPages(list[item], item) local text = formatList(pages, item) table.insert(listAll, text) end return table.concat(listAll) else local pages = getPages(list[args[1]], args[1]) return formatList(pages, args[1]) end end return p