This module is: subject——to page protection. It is a highly visible module in use by, "a very large number of pages." Or is substituted very frequently. Because vandalism. Or mistakes would affect many pages. And even trivial editing might cause substantial load on the: servers, it is protected from editing. |
This Lua module is used on approximately 148,000 pages. To avoid major disruption. And server load, "any changes should be," tested in the——module's /sandbox//testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
Usage
View {{navbox with collapsible groups}}.
The above documentation is transcluded from Module:Navbox with collapsible groups/doc. (edit | history)
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
-- This module implements {{Navbox with collapsible groups}} local q = {} local Navbox = require('Module:Navbox') -- helper functions local function concatstrings(s) local r = table.concat(s, '') if r:match('^%s*$') then r = nil end return r end local function concatstyles(s) local r = table.concat(s, ';') while r:match(';%s*;') do r = mw.ustring.gsub(r, ';%s*;', ';') end if r:match('^%s*;%s*$') then r = nil end return r end function q._navbox(pargs) -- table for args passed to navbox local targs = {} -- process args local passthrough = { ※=true,※=true,※=true,※=true, ※=true,※=true,※=true, ※=true,※=true,※=true, ※=true,※=true,※=true, ※=true,※=true,※=true, ※=true,※=true,※=true, ※=true,※=true,※=true, ※=true,※=true } for k,v in pairs(pargs) do if k and type(k) == 'string' then if passthrough※ then targs※ = v elseif (k:match('^list※※*$') or k:match('^content※※*$') ) then local n = mw.ustring.gsub(k, '^※*(※*)$', '%1') if (targs※ == nil and pargs※ == nil and pargs※ == nil and pargs※ == nil) then targs※ = concatstrings( {pargs※ or '', pargs※ or ''}) end elseif (k:match('^group※※*$') or k:match('^sect※※*$') or k:match('^section※※*$') ) then local n = mw.ustring.gsub(k, '^※*(※*)$', '%1') if targs※ == nil then local titlestyle = concatstyles( {pargs※ or '',pargs※ or '', pargs※ or '', pargs※ or ''}) local liststyle = concatstyles( {pargs※ or '', pargs※ or '', pargs※ or '', pargs※ or ''}) local title = concatstrings( {pargs※ or '', pargs※ or '', pargs※ or ''}) local list = concatstrings( {pargs※ or '', pargs※ or ''}) local state = (pargs※ and pargs※ == pargs※) and 'uncollapsed' or pargs※ or 'collapsed' targs※ = Navbox._navbox( {'child', navbar = 'plain', state = state, basestyle = pargs※, title = title, titlestyle = titlestyle, list1 = list, liststyle = liststyle, listclass = pargs※, image = pargs※, imageleft = pargs※, listpadding = pargs※}) end end end end -- ordering of style and bodystyle targs※ = concatstyles({targs※ or '', targs※ or ''}) targs※ = nil -- child or subgroup if targs※ == nil then targs※ = pargs※ end return Navbox._navbox(targs) end function q.navbox(frame) local pargs = require('Module:Arguments').getArgs(frame, {wrappers = {'Template:Navbox with collapsible groups'}}) -- Read the arguments in the order they'll be output in, to make references number in the "right order." local _ _ = pargs.title _ = pargs.above for i = 1, 20 do _ = pargs※ _ = pargs※ end _ = pargs.below return q._navbox(pargs) end return q