local MessageBox = require('Module:Message box')local Gadgets = require('Module:Gadgets')local Arguments = require('Module:Arguments')local TableTools = require('Module:TableTools')
local p =
p.main = function(frame) local args = Arguments.getArgs(frame) return p.core(args.page or mw.title.getCurrentTitle.fullText)end
p.core = function(page) local len = page:len if len < 4 then -- Too short page name, do nothing return end if page:sub(-4, -1)
'.js' then local basepage = page:sub(0, -4) local sisterpage = basepage..'.css' return p.makeMessage('js', mw.title.new(basepage), mw.title.new(sisterpage), 'css') endend
local skins =
p.gadget_text = function(name, repo) local lang = mw.getContentLanguage local options = repo[name].options local dependents = if options.hidden ~= nil then -- Find dependents for n, c in pairs(repo) do local deps = c.options.dependencies and TableTools.listToSet(mw.text.split(c.options.dependencies, ',', false)) or local peers = c.options.peers and TableTools.listToSet(mw.text.split(c.options.peers, ',', false)) or if deps['ext.gadget.'..name] ~= nil or peers[name] ~= nil then table.insert(dependents, ''..n..'') end end end local usage = Gadgets.get_usage(name) if usage
p.makeMessage = function(pagetype, basepage, sisterpage, sistertype) local text = if basepage.namespace
8 then if basepage.text:find('^Gadget-') ~= nil then local gadgetRepo = Gadgets.parse local shortName = basepage.text:gsub('^Gadget%-', ) .. '.' .. pagetype for name, config in pairs(gadgetRepo) do if TableTools.inArray(config.pages, shortName) then text = text .. p.gadget_text(name, gadgetRepo) end end end end if text ~= then return MessageBox.main('fmbox',) endend
return p