Changes
switch to mw.html per talk page (no objections)
--
-- This module will implement implements {{Navbox}}
--
local p = {}
local navbar = require('Module:Navbar')._navbar
local getArgs -- lazily initialized
local border
local listnums = {}
local function trim(s)
return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))
if tableRowAdded then
tbl
end
tableRowAdded = true
return tbl.:tag('tr')
end
-- 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.
-- 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
titleCell.:wikitext(navbar{
args.name,
mini = 1,
if spacerSide then
titleCell
end
end
local titleRow = addTableRow(tbl)
if args.titlegroup then
titleRow
end
local titleCell = titleRow.:tag('th').:attr('scope', 'col')
if args.titlegroup then
titleCell
end
titleCell
renderNavBar(titleCell)
titleCell
end
addTableRow(tbl)
end
addTableRow(tbl)
end
if listnum == 1 and args.imageleft then
row
end
if args.groupwidth then
groupCell.:css('width', args.groupwidth)
end
end
local listCell = row.:tag('td')
listCell
else
listCell.:attr('colspan', 2)
end
if not args.groupwidth then
listCell.:css('width', '100%')
end
listCell
if listnum == 1 and args.image then
row
end
end
local function needsHorizontalLists()
local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
for i, cat in ipairs(getTrackingCategories()) do
builder.:wikitext('[[Category:' .. cat .. ']]')
end
end
--
local function renderMainTable()
local tbl = HtmlBuildermw.html.create('table') .:attr('cellspacing', 0) .:addClass('nowraplinks') .:addClass(args.bodyclass)
if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
tbl
end
tbl.:css('border-spacing', 0)
if border == 'subgroup' or border == 'child' or border == 'none' then
tbl
else -- regular navobx - bodystyle and style will be applied to the wrapper table
tbl
end
tbl.:cssText(args.innerstyle)
renderTitleRow(tbl)
-- render the appropriate wrapper around the navbox, depending on the border param
local res = HtmlBuildermw.html.create()
if border == 'none' then
res.:node(tbl)
elseif border == 'subgroup' or border == 'child' then
-- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
-- padding being applied, and at the end add a <div> to balance out the parent's </div>
res
else
res
end