Anonymous user
Module:Navbox: Difference between revisions
switch to mw.html per talk page (no objections)
Enwikipedia>WOSlinker (change hasBackgroundColors to check titlestyle/groupstyle/basestyle contains the word background) |
Enwikipedia>Frietjes (switch to mw.html per talk page (no objections)) |
||
Line 1:
--
-- This module
--
local p = {}
local navbar = require('Module:Navbar')._navbar
local getArgs -- lazily initialized
Line 13 ⟶ 12:
local border
local listnums = {}
local function trim(s)
return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))
Line 30 ⟶ 29:
if tableRowAdded then
tbl
end
tableRowAdded = true
return tbl
end
Line 44 ⟶ 43:
-- 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.
Line 58 ⟶ 57:
if args.state == 'plain' then spacerSide = 'right' end
titleCell
args.name,
mini = 1,
Line 68 ⟶ 67:
if spacerSide then
titleCell
end
end
Line 82 ⟶ 81:
local titleRow = addTableRow(tbl)
if args.titlegroup then
titleRow
end
local titleCell = titleRow
if args.titlegroup then
titleCell
end
Line 109 ⟶ 108:
titleCell
renderNavBar(titleCell)
titleCell
end
Line 138 ⟶ 137:
addTableRow(tbl)
end
Line 152 ⟶ 151:
addTableRow(tbl)
end
Line 170 ⟶ 169:
if listnum == 1 and args.imageleft then
row
end
local groupCell = row
if args.groupwidth then
groupCell
end
end
local listCell = row
listCell
else
listCell
end
if not args.groupwidth then
listCell
end
Line 227 ⟶ 226:
listCell
if listnum == 1 and args.image then
row
end
end
Line 258 ⟶ 257:
local function needsHorizontalLists()
local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
Line 288 ⟶ 287:
for i, cat in ipairs(getTrackingCategories()) do
builder
end
end
Line 296 ⟶ 295:
--
local function renderMainTable()
local tbl =
if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
tbl
end
tbl
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
renderTitleRow(tbl)
Line 346 ⟶ 345:
-- render the appropriate wrapper around the navbox, depending on the border param
local res =
if border == 'none' then
res
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
Line 354 ⟶ 353:
-- padding being applied, and at the end add a <div> to balance out the parent's </div>
res
:wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
else
res
end
|