Module:Listbox
Want an adless experience? Log in or Create an account.
Documentation for this module may be created at Module:Listbox/doc
local p = require ( 'Module:Box' ) -- for use in the debug console: -- =p.list(p.debugframe) p.debugframe = { args = { [1] = "A Link to the Past", [2] = "Enemies", } } function p.list( frame ) local game = frame.args[1] local category = frame.args[2] local intersection = game .. ' ' .. category -- construct the box local box, content = p._light{ class = 'navbox', title = intersection, hide = 'show', -- TODO count number of navboxes, hide after the second or third (could relegate to the calling template) edit = intersection } -- get list of pages in the category local pages = mw.ext.dpl.getPagenames{ category = intersection, ordermethod = 'sortkey', order = 'ascending' } -- TODO get the page contents, look for grouping and variant directives, and restructure the table accordingly -- TODO support groupings using table; for now just one big hlist local hlist = content:tag( 'div' ) :addClass( 'hlist' ) :tag( 'ul' ) for i, v in ipairs(pages) do -- TODO support variants hlist:tag( 'li' ) :wikitext( '[[' .. v .. ']]' ) end -- TODO footer with catlinks (add it to the box module instead of hacking it on the end of the content's table) return tostring( box ) end return p