Editing Module:Navbox with collapsible groups
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}} | ||
require('Module:No globals') | |||
local q = {} | local q = {} | ||
local Navbox = require('Module:Navbox') | local Navbox = require('Module:Navbox/sandbox')._navbox | ||
-- helper functions | -- helper functions | ||
Line 20: | Line 21: | ||
function q._navbox(pargs) | function q._navbox(pargs) | ||
local tracking = '' | |||
-- table for args passed to navbox | -- table for args passed to navbox | ||
local targs = {} | local targs = {} | ||
Line 68: | Line 71: | ||
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, | |||
basestyle = pargs['basestyle'], | basestyle = pargs['basestyle'], | ||
title = title, titlestyle = titlestyle, | title = title, titlestyle = titlestyle, | ||
Line 77: | Line 78: | ||
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(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 | ||
-- 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 | return Navbox(targs) .. tracking | ||
end | end | ||
function q.navbox(frame) | function q.navbox(frame) | ||
local pargs = require('Module:Arguments').getArgs(frame, {wrappers = {'Template:Navbox with collapsible groups'}}) | local pargs = require('Module:Arguments').getArgs(frame, {wrappers = {'Template:Navbox with collapsible groups'}}) | ||