Module:Navbox

-- -- This module implements --

local p = {}

local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized

local args local tableRowAdded = false local border local listnums = {}

local function trim(s) return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")) end

local function addNewline(s) if s:match('^[*:;#]') or s:match('^{|') then return '\n' .. s ..'\n' else return s   end end

local function addTableRow(tbl) -- If any other rows have already been added, then we add a 2px gutter row. if tableRowAdded then tbl :tag('tr') :css('height', '2px') :tag('td') :attr('colspan',2) end

tableRowAdded = true

return tbl:tag('tr') end

local function renderNavBar(titleCell) -- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left -- or right to keep the title centered. local spacerSide = nil

if args.navbar == 'off' then -- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's       -- also no show/hide link, then we need a spacer on the right to achieve the left shift. if args.state == 'plain' then spacerSide = 'right' end elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame:getParent:getTitle:gsub('/sandbox$', '') == 'Template:Navbox') then -- No navbar. Need a spacer on the left to balance out the width of the show/hide link. if args.state ~= 'plain' then spacerSide = 'left' end else -- Will render navbar (or error message). If there's no show/hide link, need a spacer on the right -- to balance out the width of the navbar. if args.state == 'plain' then spacerSide = 'right' end

titleCell:wikitext(navbar{           args.name,            mini = 1,            fontstyle = (args.basestyle or ) .. ';' .. (args.titlestyle or ) ..  ';background:none transparent;border:none;'        }) end

-- Render the spacer div. if spacerSide then titleCell :tag('span') :css('float', spacerSide) :css('width', '6em') :wikitext(' ') end end