Content deleted Content added
add text-decoration:inherit; to navbar Tag: Reverted |
sync Tag: Reverted |
||
Line 7:
local navbar = require('Module:Navbar')._navbar
local getArgs -- lazily initialized
local args
Line 21 ⟶ 20:
-- by parent navboxes. The result is that the category shows all pages
-- where a child navbox is not contained in a parent navbox.
local orphanCat = '[[Category:Navbox orphans]]'
if border ==
-- No change; striping occurs in outermost navbox.
return wikitext ..
end
local first, second =
if args
if args
first, second = second, first
else
first = args
second = first
end
Line 39:
else
local index = 0
changer = function (code)
if code == '0' then
-- Current occurrence is for a group before a nested table.
Line 52:
end
end
local regex =
return (wikitext:gsub(regex, ''):gsub(REGEX_MARKER, changer)) -- () omits gsub count
end
Line 62:
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 =
end
table.insert(lines, line)
Line 81:
local function renderNavBar(titleCell)
▲ (args[cfg.arg.name] and not mw.getCurrentFrame():getParent():getTitle():gsub(cfg.pattern.sandbox, '') == cfg.pattern.navbox) then
titleCell:wikitext(navbar{
args
})
end
Line 99 ⟶ 95:
--
local function renderTitleRow(tbl)
if not args
local titleRow = tbl:tag('tr')
if args
titleRow
:tag('th')
:attr('scope', 'row')
:addClass(
:addClass(args
:cssText(args
:cssText(args
:cssText(args
:wikitext(args
end
local titleCell = titleRow:tag('th'):attr('scope', 'col')
if args
titleCell
:css('border-left', '2px solid #fdfdfd')
Line 124 ⟶ 120:
local titleColspan = 2
if args
if args
if args
titleCell
:cssText(args
:cssText(args
:addClass(
:attr('colspan', titleColspan)
Line 139 ⟶ 135:
:tag('div')
-- id for aria-labelledby attribute
:attr('id', mw.uri.anchorEncode(args
:addClass(args
:css('font-size', '114%')
:css('margin', '0 4em')
:wikitext(processItem(args
end
Line 152 ⟶ 148:
local function getAboveBelowColspan()
local ret = 2
if args
if args
return ret
end
local function renderAboveRow(tbl)
if not args
tbl:tag('tr')
:tag('td')
:addClass(
:addClass(args
:cssText(args
:cssText(args
:attr('colspan', getAboveBelowColspan())
:tag('div')
-- id for aria-labelledby attribute, if no title
:attr('id', args
:wikitext(processItem(args
end
local function renderBelowRow(tbl)
if not args
tbl:tag('tr')
:tag('td')
:addClass(
:addClass(args
:cssText(args
:cssText(args
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(processItem(args
end
Line 193 ⟶ 189:
local row = tbl:tag('tr')
if index == 1 and args
row
:tag('td')
:addClass(
:addClass(
:addClass(args
:css('width', '1px') -- Minimize width
:css('padding', '
:cssText(args
:attr('rowspan', #listnums)
:tag('div')
:wikitext(processItem(args
end
if args[
local groupCell = row:tag('th')
-- id for aria-labelledby attribute, if lone group with no title or above
if listnum == 1 and not (args
groupCell
:attr('id', mw.uri.anchorEncode(args
end
groupCell
:attr('scope', 'row')
:addClass(
:addClass(args
:cssText(args
:css('width', args
groupCell
:cssText(args
:cssText(args[
:wikitext(args[
end
local listCell = row:tag('td')
if args[
listCell
:css('text-align', 'left')
Line 240 ⟶ 236:
end
if not args
listCell:css('width', '100%')
end
Line 246 ⟶ 242:
local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing
if index % 2 == 1 then
rowstyle = args
else
rowstyle = args
end
local listText = args[
local oddEven = ODD_EVEN_MARKER
if listText:sub(1, 12) == '</div><table' then
-- Assume list text is for a subgroup navbox so no automatic striping for this row.
oddEven = listText:find(
end
listCell
:css('padding', '
:cssText(args
:cssText(rowstyle)
:cssText(args[
:addClass(
:addClass(
:addClass(args
:addClass(args[
:tag('div')
:css('padding', (index == 1 and args
:wikitext(processItem(listText, args
if index == 1 and args
row
:tag('td')
:addClass(
:addClass(
:addClass(args
:css('width', '1px') -- Minimize width
:css('padding', '
:cssText(args
:attr('rowspan', #listnums)
:tag('div')
:wikitext(processItem(args
end
end
Line 291 ⟶ 287:
local function needsHorizontalLists()
if border ==
return false
end
local listClasses = {
['plainlist'] = true, ['hlist'] = true, ['hlist hnum'] = true,
return not (cfg.list_classes[args[cfg.arg.listclass]] or cfg.list_classes[args[cfg.arg.bodyclass]])▼
['hlist hwrap'] = true, ['hlist vcard'] = true, ['vcard hlist'] = true,
['hlist vevent'] = true,
}
▲ return not (
end
local function hasBackgroundColors()
for _, key in ipairs({
if tostring(args[key]):find('background', 1, true) then
return true
Line 308 ⟶ 307:
local function hasBorders()
for _, key in ipairs({
if tostring(args[key]):find('border', 1, true) then
return true
Line 320 ⟶ 318:
for key, style in pairs(args) do
if tostring(key):match(
if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then
return true
Line 331 ⟶ 329:
local function getTrackingCategories()
local cats = {}
if needsHorizontalLists() then table.insert(cats,
if hasBackgroundColors() then table.insert(cats,
if isIllegible() then table.insert(cats,
if hasBorders() then table.insert(cats,
return cats
end
Line 342 ⟶ 340:
if title.namespace ~= 10 then return end -- not in template space
local subpage = title.subpageText
if subpage ==
for _, cat in ipairs(getTrackingCategories()) do
Line 355 ⟶ 352:
local function renderMainTable()
local tbl = mw.html.create('table')
:addClass(
:addClass(args
if args
if args
tbl
:addClass(
:addClass(args
end
tbl:css('border-spacing', 0)
if border ==
tbl
:addClass(
:cssText(args
:cssText(args
else -- regular navbox - bodystyle and style will be applied to the wrapper table
tbl
:addClass(
:css('background', 'transparent')
:css('color', 'inherit')
end
tbl:cssText(args
renderTitleRow(tbl)
Line 396 ⟶ 392:
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 402 ⟶ 398:
table.sort(listnums)
border = mw.text.trim(args
if border ==
border =
end
Line 412 ⟶ 408:
-- render the appropriate wrapper around the navbox, depending on the border param
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
nav:attr('aria-labelledby', mw.uri.anchorEncode(args
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
Line 433 ⟶ 429:
local nav = res:tag('div')
:attr('role', 'navigation')
:addClass(
:addClass(args
:cssText(args
:cssText(args
:css('padding', '3px')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args
nav:attr('aria-labelledby', mw.uri.anchorEncode(args
else
nav:attr('aria-label',
end
end
if (args
renderTrackingCategories(res)
end
Line 457 ⟶ 453:
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame, {wrappers = {'Template:Navbox'}})
-- Read the arguments in the order they'll be output in, to make references number in the right order.
local _
_ = args
_ = args
for i = 1, 20 do
_ = args[
_ = args[
end
_ = args
return p._navbox(args)
|