Content deleted Content added
ok, restart, and clearly delineate what's happening |
remove border from globals |
||
Line 9:
local args
local listnums
local ODD_EVEN_MARKER = '\127_ODDEVEN_\127'
Line 15 ⟶ 14:
local REGEX_MARKER = '\127_ODDEVEN(%d?)_\127'
local function striped(wikitext, border)
-- Return wikitext with markers replaced for odd/even striping.
-- Child (subgroup) navboxes are flagged with a category that is removed
Line 286 ⟶ 285:
--
local function needsHorizontalLists(border)
if border == 'subgroup' or args.tracking == 'no' then
return false
Line 327 ⟶ 326:
end
local function getTrackingCategories(border)
local cats = {}
if needsHorizontalLists(border) then table.insert(cats, 'Navigational boxes without horizontal lists') end
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end
Line 336 ⟶ 335:
end
local function renderTrackingCategories(builder, border)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 then return end -- not in template space
Line 342 ⟶ 341:
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
for _, cat in ipairs(getTrackingCategories(border)) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
Line 350 ⟶ 349:
-- Main navbox tables
--
local function renderMainTable(border)
local tbl = mw.html.create('table')
:addClass('nowraplinks')
Line 398 ⟶ 397:
table.sort(listnums)
local border = mw.text.trim(args.border or args[1] or '')
if border == 'child' then
border = 'subgroup'
Line 404 ⟶ 403:
-- render the main body of the navbox
local tbl = renderMainTable(border)
-- render the appropriate wrapper around the navbox, depending on the border param
Line 444 ⟶ 443:
if (args.nocat or 'false'):lower() == 'false' then
renderTrackingCategories(res, border)
end
return striped(tostring(res), border)
end
|