-- This implements Template:navboxes
local p = {}
local getArgs = require('Module:Arguments').getArgs
local navbox = require('Module:Navbox')._navbox
local function navboxes(args, list)
local state = args['state'] or 'collapsed'
local navbar = 'plain'
if args['state'] == 'off' then
navbar = 'off'
end
local title = args['title'] or 'Links to related articles'
local titlestyles = {
background = args['bg'] or '#e8e8ff'
}
if args['fg'] then
titlestyles['color'] = args['fg']
end
if args['bordercolor'] then
titlestyles['border'] = '1px solid ' .. args['bordercolor']
end
local titlestyle = ''
for k, v in pairs(titlestyles) do
titlestyle = titlestyle .. k .. ':' .. v .. ';'
end
titlestyle = titlestyle .. (args['titlestyle'] or '')
return navbox({
navbar = navbar,
title = title,
list1 = list,
state = state,
titlestyle = titlestyle,
liststyle = 'font-size:114%;',
listpadding = '0px',
tracking = 'no'
})
end
function p.top(frame)
local args = getArgs(frame)
local parts = mw.text.split(navboxes(args, '<ADD LIST HERE>'), '<ADD LIST HERE>')
return parts[1]
end
function p.bottom(frame)
local args = {}
local parts = mw.text.split(navboxes(args, '<ADD LIST HERE>'), '<ADD LIST HERE>')
return parts[2]
end
function p.navbox(frame)
local args = getArgs(frame)
local list = args['list1'] or args['list'] or ''
local track_cats = ''
if list == '' then
if mw.title.getCurrentTitle():inNamespace(0) then
track_cats = '[[Category:' .. 'Navboxes template with no content' .. ']]'
end
end
return navboxes(args, list) .. track_cats
end
return p