return tostring(root)
end
function p_collapsibleSidebar(args) args.abovestyle = 'border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;' ..sidebar(frameargs.abovestyle or '') for k, v in pairs(args) do local origArgsnum = ('' .. k):match('^list(%d+)$') if frame num then local expand = args.expanded == 'all' or args.expanded ==args['list' .. num .. 'name'] local row = mwHtmlBuilder.create('div') row .addClass('NavFrame') .addClass((not expand) and 'collapsed') .css('border', 'none') .css('padding', 0) .cssText(args.listframestyle) .cssText(args['list' .. num .. 'style']) .tag('div') .addClass('NavHead') .getCurrentFrameaddClass(args.listtitleclass) then .css('font-size', '105%') .css('background', 'transparent') .css('text- Wealign', 're being called via #invokeleft') .cssText(args.basestyle) .cssText(args.listtitlestyle) . If the invoking template passed any cssText(args, use['list' .. num .. 'titlestyle']) -- them . Otherwise, use the wikitext(args that were passed into the template['list' .. num .. 'title'] or 'List') .done() .tag('div') origArgs = frame:getParent .addClass('NavContent') .addClass(args.listclass) for k .addClass(args['list' .. num .. 'class']) .css('font-size', '105%') .css('padding', '0.2em 0 0.4em') .css('text-align', v in pairs'center') .cssText(frameargs.liststyle) .cssText(args['list' .. num .. 'style']) do origArgs = frame .wikitext(args['list' .. num]) breakargs['content' .. num] = tostring(row)
end
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
origArgs = frame
end
return _sidebar(args)end function makeWrapper(func) return function(frame) local origArgs if frame == mw.getCurrentFrame() then -- We're being called via #invoke. If the invoking template passed any args, use -- them. Otherwise, use the args that were passed into the template. origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else -- We're being called from another module or from the debug console, so assume -- the args are passed in directly. origArgs = frame end -- ParserFunctions considers the empty string to be false, so to preserve the previous -- behavior of the template, change any empty arguments to nil, so Lua will consider -- them false too. local args = {} for k, v in pairs(origArgs) do if v ~= '' then args[k] = v end
end
return func(args)
end
return _sidebar(args)
end
return p{ sidebar = makeWrapper(_sidebar), collapsible = makeWrapper(_collapsibleSidebar)}