Editing Module:Navbox
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 10: | Line 10: | ||
local args | local args | ||
local border | local border | ||
local listnums | local listnums = {} | ||
local ODD_EVEN_MARKER = '\127_ODDEVEN_\127' | local ODD_EVEN_MARKER = '\127_ODDEVEN_\127' | ||
local RESTART_MARKER = '\127_ODDEVEN0_\127' | local RESTART_MARKER = '\127_ODDEVEN0_\127' | ||
Line 85: | Line 85: | ||
args.name, | args.name, | ||
mini = 1, | mini = 1, | ||
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none | fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;' | ||
}) | }) | ||
end | end | ||
Line 134: | Line 134: | ||
titleCell | titleCell | ||
:tag('div') | :tag('div') | ||
:attr('id', mw.uri.anchorEncode(args.title)) | :attr('id', mw.uri.anchorEncode(args.title)) | ||
:addClass(args.titleclass) | :addClass(args.titleclass) | ||
Line 164: | Line 163: | ||
:attr('colspan', getAboveBelowColspan()) | :attr('colspan', getAboveBelowColspan()) | ||
:tag('div') | :tag('div') | ||
:wikitext(processItem(args.above, args.nowrapitems)) | :wikitext(processItem(args.above, args.nowrapitems)) | ||
end | end | ||
Line 192: | Line 189: | ||
row | row | ||
:tag('td') | :tag('td') | ||
:addClass('navbox-image') | :addClass('navbox-image') | ||
:addClass(args.imageclass) | :addClass(args.imageclass) | ||
Line 205: | Line 201: | ||
if args['group' .. listnum] then | if args['group' .. listnum] then | ||
local groupCell = row:tag('th') | local groupCell = row:tag('th') | ||
groupCell | groupCell | ||
Line 217: | Line 207: | ||
:addClass(args.groupclass) | :addClass(args.groupclass) | ||
:cssText(args.basestyle) | :cssText(args.basestyle) | ||
:css('width', args.groupwidth or '1%') -- If groupwidth not specified, minimize width | |||
groupCell | groupCell | ||
Line 261: | Line 251: | ||
:addClass('navbox-' .. oddEven) | :addClass('navbox-' .. oddEven) | ||
:addClass(args.listclass) | :addClass(args.listclass) | ||
:tag('div') | :tag('div') | ||
:css('padding', (index == 1 and args.list1padding) or args.listpadding or '0em 0.25em') | :css('padding', (index == 1 and args.list1padding) or args.listpadding or '0em 0.25em') | ||
Line 269: | Line 258: | ||
row | row | ||
:tag('td') | :tag('td') | ||
:addClass('navbox-image') | :addClass('navbox-image') | ||
:addClass(args.imageclass) | :addClass(args.imageclass) | ||
Line 299: | Line 287: | ||
local function hasBackgroundColors() | local function hasBackgroundColors() | ||
for _, key in ipairs({'titlestyle', 'groupstyle', 'basestyle | for _, key in ipairs({'titlestyle', 'groupstyle', 'basestyle'}) do | ||
if tostring(args[key]):find('background', 1, true) then | if tostring(args[key]):find('background', 1, true) then | ||
return true | return true | ||
end | end | ||
Line 332: | Line 312: | ||
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end | if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end | ||
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end | if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end | ||
return cats | return cats | ||
end | end | ||
Line 356: | Line 335: | ||
if args.title and (args.state ~= 'plain' and args.state ~= 'off') then | if args.title and (args.state ~= 'plain' and args.state ~= 'off') then | ||
tbl | tbl | ||
:addClass(' | :addClass('collapsible') | ||
:addClass(args.state or 'autocollapse') | :addClass(args.state or 'autocollapse') | ||
end | end | ||
Line 365: | Line 343: | ||
if border == 'subgroup' or border == 'none' then | if border == 'subgroup' or border == 'none' then | ||
tbl | tbl | ||
:addClass('navbox-subgroup') | :addClass('navbox-subgroup navbox-spacing-temp') | ||
:cssText(args.bodystyle) | :cssText(args.bodystyle) | ||
:cssText(args.style) | :cssText(args.style) | ||
Line 388: | Line 366: | ||
function p._navbox(navboxArgs) | function p._navbox(navboxArgs) | ||
args = navboxArgs | args = navboxArgs | ||
for k, _ in pairs(args) do | for k, _ in pairs(args) do | ||
Line 412: | Line 389: | ||
:attr('role', 'navigation') | :attr('role', 'navigation') | ||
:node(tbl) | :node(tbl) | ||
if args.title then | |||
if args.title | nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title)) | ||
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title | |||
else | else | ||
nav:attr('aria-label', 'Navbox') | nav:attr('aria-label', 'Navbox') | ||
Line 429: | Line 405: | ||
local nav = res:tag('div') | local nav = res:tag('div') | ||
:attr('role', 'navigation') | :attr('role', 'navigation') | ||
:addClass('navbox' | :addClass('navbox navbox-spacing-temp') | ||
:cssText(args.bodystyle) | :cssText(args.bodystyle) | ||
:cssText(args.style) | :cssText(args.style) | ||
:css('padding', '3px') | :css('padding', '3px') | ||
:node(tbl) | :node(tbl) | ||
if args.title then | |||
if args.title | nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title)) | ||
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title | |||
else | else | ||
nav:attr('aria-label', 'Navbox') | nav:attr('aria-label', 'Navbox') | ||
Line 443: | Line 417: | ||
end | end | ||
renderTrackingCategories(res) | |||
return striped(tostring(res)) | return striped(tostring(res)) | ||
end | end | ||
Line 453: | Line 426: | ||
getArgs = require('Module:Arguments').getArgs | getArgs = require('Module:Arguments').getArgs | ||
end | end | ||
args = getArgs(frame, {wrappers = | 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. | -- Read the arguments in the order they'll be output in, to make references number in the right order. |