Editing Module:Navbox with collapsible groups

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. Read the Privacy Policy to learn what information we collect about you and how we use it.

If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
-- This module implements {{Navbox with collapsible groups}}
-- This module implements {{Navbox with collapsible groups}}
local q = {}
require('Module:No globals')
local p = {}
 
local Navbox = require('Module:Navbox')
local Navbox = require('Module:Navbox')
local getArgs -- lazily initialized


-- helper functions
-- helper functions
Line 19: Line 22:
end
end


function q._navbox(pargs)
function p._navbox(pargs)
local tracking = ''
-- table for args passed to navbox
-- table for args passed to navbox
local targs = {}
local targs = {}
Line 43: Line 48:
if (targs['list' .. n] == nil and pargs['group' .. n] == nil
if (targs['list' .. n] == nil and pargs['group' .. n] == nil
and pargs['sect' .. n] == nil and pargs['section' .. n] == nil) then
and pargs['sect' .. n] == nil and pargs['section' .. n] == nil) then
targs['list' .. n] = concatstrings(
targs['list' .. n] = concatstrings(pargs['list' .. n] or '', pargs['content' .. n] or '')
{pargs['list' .. n] or '', pargs['content' .. n] or ''})
end
end
elseif (k:match('^group[0-9][0-9]*$')  
elseif (k:match('^group[0-9][0-9]*$')  
Line 68: Line 72:
local state = (pargs['abbr' .. n] and pargs['abbr' .. n] == pargs['selected'])  
local state = (pargs['abbr' .. n] and pargs['abbr' .. n] == pargs['selected'])  
and 'uncollapsed' or pargs['state' .. n] or 'collapsed'
and 'uncollapsed' or pargs['state' .. n] or 'collapsed'
local sargs = {'child', navbar = 'plain', state = state,
targs['list' .. n] = Navbox._navbox(
{'child', navbar = 'plain', state = state,
basestyle = pargs['basestyle'],
basestyle = pargs['basestyle'],
title = title, titlestyle = titlestyle,
title = title, titlestyle = titlestyle,
Line 77: Line 79:
image = pargs['image' .. n],
image = pargs['image' .. n],
imageleft = pargs['imageleft' .. n],
imageleft = pargs['imageleft' .. n],
listpadding = pargs['listpadding']})
listpadding = pargs['listpadding']}
targs['list' .. n] = Navbox._navbox(sargs)
tracking = tracking .. '<hr /><center><b>k = ' .. k .. ', n = ' .. n .. '</b></center><hr />\n'
for ks,vs in pairs(sargs) do
tracking = tracking .. ks .. ' = ' .. vs .. '<br>\n'
end
tracking = tracking .. '\n<hr />\n'
end
end
end
end
end
end
end
end
-- ordering of style and bodystyle
 
targs['style'] = concatstyles({targs['style'] or '', targs['bodystyle'] or ''})
targs['bodystyle'] = nil
-- child or subgroup
-- child or subgroup
if targs['border'] == nil then targs['border'] = pargs[1] end
if targs['border'] == nil then targs['border'] = pargs[1] end
-- debug
tracking = tracking .. '<hr /><center><b>targs</b></center><hr />\n'
for k,v in pairs(targs) do
tracking = tracking .. k .. ' = ' .. v .. '<br>\n'
end
tracking = tracking .. '\n<hr />\n'


return Navbox._navbox(targs)
return Navbox._navbox(targs) .. tracking
end
end


function q.navbox(frame)
function p.navbox(frame)
local pargs = require('Module:Arguments').getArgs(frame, {wrappers = {'Template:Navbox with collapsible groups'}})
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
local pargs = 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.
-- Read the arguments in the order they'll be output in, to make references number in the right order.
Line 105: Line 120:
_ = pargs.below
_ = pargs.below


return q._navbox(pargs)
return p._navbox(pargs)
end
end


return q
return p
Please note that all contributions to Nonbinary Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see Nonbinary Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Template used on this page: