Content deleted Content added
fix actually |
convert entirety of rest of the args |
||
Line 16:
-- where a child navbox is not contained in a parent navbox.
local orphanCat = '[[Category:Navbox orphans]]'
if border == 'subgroup' and args[cfg.arg.orphan] ~= 'yes' then
-- No change; striping occurs in outermost navbox.
return wikitext .. orphanCat
end
local first, second = 'odd', 'even'
if args[cfg.arg.evenodd] then
if args[cfg.arg.evenodd] == 'swap' then
first, second = second, first
else
first = args[cfg.arg.evenodd]
second = first
end
Line 76:
local function renderNavBar(titleCell)
if args[cfg.arg.navbar] ~= 'off' and args[cfg.arg.navbar] ~= 'plain' and not (not args[cfg.arg.name] and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', '') == 'Template:Navbox') then
titleCell:wikitext(navbar{
args[cfg.arg.name],
mini = 1,
fontstyle = (args[cfg.arg.basestyle] or '') .. ';' .. (args[cfg.arg.titlestyle] or '') .. ';background:none transparent;border:none;box-shadow:none;padding:0;'
})
end
Line 90:
--
local function renderTitleRow(tbl)
if not args[cfg.arg.title] then return end
local titleRow = tbl:tag('tr')
if args[cfg.arg.titlegroup] then
titleRow
:tag('th')
:attr('scope', 'row')
:addClass('navbox-group')
:addClass(args[cfg.arg.titlegroupclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.groupstyle])
:cssText(args[cfg.arg.titlegroupstyle])
:wikitext(args[cfg.arg.titlegroup])
end
local titleCell = titleRow:tag('th'):attr('scope', 'col')
if args[cfg.arg.titlegroup] then
titleCell
:css('border-left', '2px solid #fdfdfd')
Line 115:
local titleColspan = 2
if args[cfg.arg.imageleft] then titleColspan = titleColspan + 1 end
if args[cfg.arg.image] then titleColspan = titleColspan + 1 end
if args[cfg.arg.titlegroup] then titleColspan = titleColspan - 1 end
titleCell
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.titlestyle])
:addClass('navbox-title')
:attr('colspan', titleColspan)
Line 130:
:tag('div')
-- id for aria-labelledby attribute
:attr('id', mw.uri.anchorEncode(args[cfg.arg.title]))
:addClass(args[cfg.arg.titleclass])
:css('font-size', '114%')
:css('margin', '0 4em')
:wikitext(processItem(args[cfg.arg.title]))
end
Line 143:
local function getAboveBelowColspan()
local ret = 2
if args[cfg.arg.imageleft] then ret = ret + 1 end
if args[cfg.arg.image] then ret = ret + 1 end
return ret
end
local function renderAboveRow(tbl)
if not args[cfg.arg.above] then return end
tbl:tag('tr')
:tag('td')
:addClass('navbox-abovebelow')
:addClass(args[cfg.arg.aboveclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.abovestyle])
:attr('colspan', getAboveBelowColspan())
:tag('div')
-- id for aria-labelledby attribute, if no title
:attr('id', args[cfg.arg.title] and nil or mw.uri.anchorEncode(args[cfg.arg.above]))
:wikitext(processItem(args[cfg.arg.above], args[cfg.arg.nowrapitems]))
end
local function renderBelowRow(tbl)
if not args[cfg.arg.below] then return end
tbl:tag('tr')
:tag('td')
:addClass('navbox-abovebelow')
:addClass(args[cfg.arg.belowclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.belowstyle])
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(processItem(args[cfg.arg.below], args[cfg.arg.nowrapitems]))
end
Line 184:
local row = tbl:tag('tr')
if index == 1 and args[cfg.arg.imageleft] then
row
:tag('td')
:addClass('noviewer')
:addClass('navbox-image')
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
:css('padding', '0px 2px 0px 0px')
:cssText(args[cfg.arg.imageleftstyle])
:attr('rowspan', listnums_size)
:tag('div')
:wikitext(processItem(args[cfg.arg.imageleft]))
end
Line 204:
-- id for aria-labelledby attribute, if lone group with no title or above
if listnum == 1 and not (args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group2]) then
groupCell
:attr('id', mw.uri.anchorEncode(args[cfg.arg.group1]))
end
Line 212:
:attr('scope', 'row')
:addClass('navbox-group')
:addClass(args[cfg.arg.groupclass])
:cssText(args[cfg.arg.basestyle])
:css('width', args[cfg.arg.groupwidth] or '1%') -- If groupwidth not specified, minimize width
groupCell
:cssText(args[cfg.arg.groupstyle])
:cssText(args[groupstyle_and_num])
:wikitext(args[group_and_num])
Line 233:
end
if not args[cfg.arg.groupwidth] then
listCell:css('width', '100%')
end
Line 239:
local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing
if index % 2 == 1 then
rowstyle = args[cfg.arg.oddstyle]
else
rowstyle = args[cfg.arg.evenstyle]
end
Line 256:
listCell
:css('padding', '0px')
:cssText(args[cfg.arg.liststyle])
:cssText(rowstyle)
:cssText(args[liststyle_and_num])
:addClass('navbox-list')
:addClass('navbox-' .. oddEven)
:addClass(args[cfg.arg.listclass])
:addClass(args[listclass_and_num])
:tag('div')
:css('padding', (index == 1 and args[cfg.arg.list1padding]) or args[cfg.arg.listpadding] or '0em 0.25em')
:wikitext(processItem(listText, args[cfg.arg.nowrapitems]))
if index == 1 and args[cfg.arg.image] then
row
:tag('td')
:addClass('noviewer')
:addClass('navbox-image')
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
:css('padding', '0px 0px 0px 2px')
:cssText(args[cfg.arg.imagestyle])
:attr('rowspan', listnums_size)
:tag('div')
:wikitext(processItem(args[cfg.arg.image]))
end
end
Line 288:
local function needsHorizontalLists(border)
if border == 'subgroup' or args[cfg.arg.tracking] == 'no' then
return false
end
Line 296:
['hlist vevent'] = true,
}
return not (listClasses[args[cfg.arg.listclass]] or listClasses[args[cfg.arg.bodyclass]])
end
Line 354:
local tbl = mw.html.create('table')
:addClass('nowraplinks')
:addClass(args[cfg.arg.bodyclass])
if args[cfg.arg.title] and (args[cfg.arg.state] ~= 'plain' and args[cfg.arg.state] ~= 'off') then
if args[cfg.arg.state] == 'collapsed' then args[cfg.arg.state] = 'mw-collapsed' end
tbl
:addClass('mw-collapsible')
:addClass(args[cfg.arg.state] or 'autocollapse')
end
Line 367:
tbl
:addClass('navbox-subgroup')
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
else -- regular navbox - bodystyle and style will be applied to the wrapper table
tbl
Line 375:
:css('color', 'inherit')
end
tbl:cssText(args[cfg.arg.innerstyle])
renderTitleRow(tbl)
Line 400:
table.sort(listnums)
local border = mw.text.trim(args[cfg.arg.border] or args[1] or '')
if border == 'child' then
border = 'subgroup'
Line 415:
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then
nav:attr('aria-labelledby', mw.uri.anchorEncode(args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]))
else
nav:attr('aria-label', 'Navbox')
Line 432:
:attr('role', 'navigation')
:addClass('navbox')
:addClass(args[cfg.arg.navboxclass])
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
:css('padding', '3px')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then
nav:attr('aria-labelledby', mw.uri.anchorEncode(args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]))
else
nav:attr('aria-label', 'Navbox')
Line 445:
end
if (args[cfg.arg.nocat] or 'false'):lower() == 'false' then
renderTrackingCategories(res, border)
end
Line 459:
-- Read the arguments in the order they'll be output in, to make references number in the right order.
local _
_ = args[cfg.arg.title]
_ = args[cfg.arg.above]
-- TODO: we have infinite now, so why is this limited to 20? :D
for i = 1, 20 do
Line 466:
_ = args[format(cfg.arg.list_and_num, i)]
end
_ = args[cfg.arg.below]
return p._navbox(args)
|