Module:Sandbox

--This module is invoked by Template:Nav

local p = {} local getArgs = require('Module:Arguments').getArgs local common = require('Module:Common')

function p.main(frame) args = getArgs(frame) if(pcall(p._main, args)) then return p._main(args) else return ' Error. See Template:Nav for more info. '   end end

function p._main(args) local out, border, templink, class, style, styleFE, headerFE, header, style1 local frame = mw.getCurrentFrame local rows = '' local nHead, nSub = 15, 10 -- number of Headers and Subheaders for iteration

-- Initialize args border =   common.setDefault(args.border, '#999') templink = common.setDefault(args.templink, 'Nav') class =    common.setDefault(args.class) style =    common.setDefault(args.style) styleFE =  common.setDefault(args.styleFE) header =   common.setDefault(args.header, 'Header') style1 =   common.setDefault(args.style1)

-- Top row if(args.headerFE ~= nil) then rows = rows..' '..args.headerFE..' ' end -- Sections for i = 1, nHead do       if(args['header'..i] ~= nil) then rows = rows.. '\n{|class="mw-collapsible mw-collapsed" width=100% cellspacing=0 cellpadding=0'.. '\n!colspan=2 style="'..common.setDefault(args['style'..i], style1)..'"'.. '| '..args['header'..i]..' ' if(args['content'..i] ~= nil) then rows = rows..'\n|-\n| '..args['content'..i]           else for j = 1, nSub do                   if(args['subheader'..i..'-'..j] ~= nil) then if(j == 1) then rows = rows..'\n|-\n!style="width:15%; '                       else                            rows = rows..'\n|-\n!style="width:15%; border-top: 1px solid #001866; ' end rows = rows..common.setDefault(args['substyle'..i..'-'..j], style1).. '"| '..args['subheader'..i..'-'..j]..                       '\n|style="padding: 3px; border-top: 1px solid '..border..'; text-align: left"| '                        ..common.setDefault(args['subcontent'..i..'-'..j])                    end                end            end            rows = rows..'\n|}'        end    end    -- Final output    out =     ''..    ' '..    ' '..    frame:expandTemplate{ title = 'Tnav', args = { 'Template:'..templink, fontcolor = '' } }..    ' '..    header..    ' '..    ' '..    rows..    '  '    return out end

return p --