Content deleted Content added
-sandbox |
pass border down Tag: Reverted |
||
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 81 ⟶ 80:
local function renderNavBar(titleCell)
if args.navbar ~= 'off' and args.navbar ~= 'plain' and
not (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', '') == 'Template:Navbox') then titleCell:wikitext(navbar{
args.name,
mini = 1,
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') ..
';background:none transparent;border:none;box-shadow:none;padding:0;' })
end
Line 286 ⟶ 287:
--
local function needsHorizontalLists(border)
if border == 'subgroup' or args.tracking == 'no' then
return false
Line 327 ⟶ 328:
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 ⟶ 337:
end
local function renderTrackingCategories(builder, border)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 then return end -- not in template space
Line 342 ⟶ 343:
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 ⟶ 351:
-- Main navbox tables
--
local function renderMainTable(border)
local tbl = mw.html.create('table')
:addClass('nowraplinks')
Line 398 ⟶ 399:
table.sort(listnums)
local border = mw.text.trim(args.border or args[1] or '')
if border == 'child' then
border = 'subgroup'
Line 404 ⟶ 405:
-- 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 ⟶ 445:
if (args.nocat or 'false'):lower() == 'false' then
renderTrackingCategories(res, border)
end
return striped(tostring(res, border))
end
|