Content deleted Content added
le fail Tag: Reverted |
hopefully nothing breaks? full l10n I think Tag: Reverted |
||
Line 18:
local first, second = 'odd', 'even'
if args[cfg.arg.evenodd] then
if args[cfg.arg.evenodd] ==
first, second = second, first
else
Line 54:
return '\n' .. item ..'\n'
end
if nowrapitems ==
local lines = {}
for line in (item .. '\n'):gmatch('([^\n]*)\n') do
local prefix, content = line:match('^([*:;#]+)%s*(.*)')
if prefix and not content:match(
line = format(nowrap_item, prefix
end
table.insert(lines, line)
Line 74:
if args[cfg.arg.navbar] ~= cfg.keyword.navbar_off and
args[cfg.arg.navbar] ~= cfg.keyword.navbar_plain and
(args[cfg.arg.name] or not
mw.getCurrentFrame():getParent():getTitle():gsub( == titleCell:wikitext(navbar{
args[cfg.arg.name],
Line 95 ⟶ 97:
:tag('th')
:attr('scope', 'row')
:addClass(
:addClass(args[cfg.arg.titlegroupclass])
:cssText(args[cfg.arg.basestyle])
Line 119 ⟶ 121:
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.titlestyle])
:addClass(
:attr('colspan', titleColspan)
Line 146 ⟶ 148:
tbl:tag('tr')
:tag('td')
:addClass(
:addClass(args[cfg.arg.aboveclass])
:cssText(args[cfg.arg.basestyle])
Line 153 ⟶ 155:
: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
Line 162 ⟶ 167:
tbl:tag('tr')
:tag('td')
:addClass(
:addClass(args[cfg.arg.belowclass])
:cssText(args[cfg.arg.basestyle])
Line 177 ⟶ 182:
row
:tag('td')
:addClass(
:addClass(
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
Line 194 ⟶ 199:
-- 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]))
Line 201 ⟶ 207:
groupCell
:attr('scope', 'row')
:addClass(
:addClass(args[cfg.arg.groupclass])
:cssText(args[cfg.arg.basestyle])
Line 241 ⟶ 247:
local oddEven = cfg.marker.oddeven
if listText:sub(1, 12) == '</div><table' then
-- Assume list text is for a subgroup navbox so no
oddEven = listText:find(
and cfg.marker.restart or 'odd' end
listCell
Line 249 ⟶ 256:
:cssText(rowstyle)
:cssText(args[liststyle_and_num])
:addClass(
:addClass('navbox-' .. oddEven)
:addClass(args[cfg.arg.listclass])
:addClass(args[listclass_and_num])
:tag('div')
:css(
:css('padding', (index == 1 and args[cfg.arg.list1padding]) or args[cfg.arg.listpadding] or '0 0.25em')▼
'padding',
▲
or args[cfg.arg.listpadding] or '0 0.25em'
)
:wikitext(processItem(listText, args[cfg.arg.nowrapitems]))
Line 260 ⟶ 271:
row
:tag('td')
:addClass(
:addClass(
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
Line 277 ⟶ 288:
return false
end
return not (cfg.list_classes[args[cfg.arg.listclass]]
or cfg.list_classes[args[cfg.arg.bodyclass]]) end
local function hasBackgroundColors()
for _, key in ipairs(
if tostring(args[key]):find('background', 1, true) then
return true
Line 289 ⟶ 301:
local function hasBorders()
for _, key in ipairs(
if tostring(args[key]):find('border', 1, true) then
return true
Line 300 ⟶ 312:
for key, style in pairs(args) do
if tostring(key):match(
if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then
return true
Line 311 ⟶ 323:
local function getTrackingCategories(border)
local cats = {}
if needsHorizontalLists(border) then
end
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end▼
if hasBackgroundColors() then
if hasBorders() then table.insert(cats, 'Navboxes using borders') end▼
table.insert(cats, cfg.category.background_colors)
end
return cats
end
Line 322 ⟶ 338:
if title.namespace ~= 10 then return end -- not in template space
local subpage = title.subpageText
if subpage == cfg.keyword.subpage_doc
or subpage == cfg.keyword.subpage_sandbox
or subpage == cfg.keyword.subpage_testcases then
return
end
for _, cat in ipairs(getTrackingCategories(border)) do
Line 331 ⟶ 351:
local function renderMainTable(border, listnums)
local tbl = mw.html.create('table')
:addClass(
:addClass(args[cfg.arg.bodyclass])
if args[cfg.arg.title]
and and args[cfg.arg.state] ~= if args[cfg.arg.state] ==
args[cfg.arg.state] = end tbl
:addClass(
:addClass(args[cfg.arg.state] or
end
tbl:css('border-spacing', 0)
if border ==
or border == cfg.keyword.border_none then
tbl
:addClass(
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
else
tbl
:addClass(
:css('background', 'transparent')
:css('color', 'inherit')
Line 372 ⟶ 397:
for k, _ in pairs(args) do
if type(k) == 'string' then
local listnum = k:match(
if listnum then table.insert(listnums, tonumber(listnum)) end
end
Line 379 ⟶ 404:
local border = mw.text.trim(args[cfg.arg.border] or args[1] or '')
if border ==
border =
end
Line 386 ⟶ 411:
local tbl = renderMainTable(border, listnums)
-- render the appropriate wrapper around the navbox, depending on
local res = mw.html.create()
if border ==
local nav = res:tag('div')
:attr('role', 'navigation')
: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',
end
elseif border ==
-- We assume that this navbox is being rendered in a list cell of a
-- parent navbox, and is therefore inside a div with padding:0em 0.25em.
-- We start with a </div> to avoid the padding being applied, and at the
-- end add a <div> to balance out the parent's </div> res
:wikitext('</div>')
Line 409 ⟶ 442:
local nav = res:tag('div')
:attr('role', 'navigation')
:addClass(
:addClass(args[cfg.arg.navboxclass])
:cssText(args[cfg.arg.bodystyle])
Line 416 ⟶ 449:
: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',
end
end
if (args[cfg.arg.nocat] or
== cfg.keyword.nocat_false then
renderTrackingCategories(res, border)
end
Line 433 ⟶ 474:
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame, {wrappers = {
-- Read the arguments in the order they'll be output in, to make references
|