440
edits
No edit summary |
m (38 revisions imported from wikipedia:Module:Navbox_with_collapsible_groups) |
||
(24 intermediate revisions by 3 users not shown) | |||
Line 1:
-- This module implements {{Navbox with collapsible groups}}
local
local Navbox = require('Module:Navbox')
-- helper functions
Line 21 ⟶ 19:
end
function
-- table for args passed to navbox
local targs = {}
Line 29 ⟶ 25:
-- process args
local passthrough = {
['name']=
['bodyclass']=
['style']=
['title']=
['above']=
['below']=
['image']=
['imageleft']=
}
for k,v in pairs(
if k and type(k) == 'string' then
if passthrough[k] then
Line 45 ⟶ 41:
or k:match('^content[0-9][0-9]*$') ) then
local n = mw.ustring.gsub(k, '^[a-z]*([0-9]*)$', '%1')
if (targs['list' .. n] == nil and
and
targs['list' .. n] = concatstrings(
{pargs['list' .. n] or '', pargs['content' .. n] or ''})
end
elseif (k:match('^group[0-9][0-9]*$')
Line 55 ⟶ 52:
if targs['list' .. n] == nil then
local titlestyle = concatstyles(
{
local liststyle = concatstyles(
{
local title = concatstrings(
{
local list = concatstrings(
{
local state = (
and 'uncollapsed' or
local sargs = {'child', navbar = 'plain', state = state,▼
basestyle = args['basestyle'],▼
title = title, titlestyle = titlestyle,
list1 = list, liststyle = liststyle,
listclass =
image =
imageleft =
listpadding =
▲ targs['list' .. n] = Navbox._navbox(sargs)
▲ 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
if targs['border'] == nil then targs['border'] =
return Navbox._navbox(targs)
end
function
▲ args = 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 _
_ =
_ =
for i = 1, 20 do
_ =
_ =
end
_ =
return
end
return
|