Module:Navbox/sandbox: Difference between revisions

Content deleted Content added
Missing #
sandbox config
 
(5 intermediate revisions by 2 users not shown)
Line 24:
 
-- helper functions
local andnum = function(s, n) return string.format(cfg.arg[s .. '_and_num'], n) end
local isblank = function(v) return (v or '') == '' end
 
Line 118:
-- Applying nowrap to lines in a table does not make sense.
-- Add newlines to compensate for trim of x in |parm=x in a template.
return '\n' .. item .. '\n'
end
if nowrapitems == cfg.keyword.nowrapitems_yes then
Line 132:
end
if item:match('^[*:;#]') then
return '\n' .. item .. '\n'
end
return item
Line 156:
local function renderNavBar(titleCell)
if has_navbar() then
local navbar = require('Module:Navbar/sandbox')._navbar
titleCell:wikitext(navbar{
[cfg.navbar.name] = args[cfg.arg.name],
Line 190:
:tag('div')
-- id for aria-labelledby attribute
:attr('id', mw.uri.anchorEncode(args[cfg.arg.title]) .. args.argHash)
:addClass(args[cfg.arg.titleclass])
:css('font-size', '114%')
Line 217:
-- id for aria-labelledby attribute, if no title
:attr('id', (not args[cfg.arg.title]) and
(mw.uri.anchorEncode(args[cfg.arg.above]) .. args.argHash)
or nil)
:wikitext(processItem(args[cfg.arg.above], args[cfg.arg.nowrapitems]))
Line 245:
:addClass(cfg.class.navbox_image)
:addClass(args[cfg.arg.imageclass])
:css('width', '1px0px') -- Minimize width
:css('padding', '0 2px 0 0')
:cssText(args[cfg.arg.imageleftstyle])
Line 261:
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]) .. args.argHash)
end
 
Line 331:
:addClass(cfg.class.navbox_image)
:addClass(args[cfg.arg.imageclass])
:css('width', '1px0px') -- Minimize width
:css('padding', '0 0 0 2px')
:cssText(args[cfg.arg.imagestyle])
Line 546:
if type(k) == 'string' then
local listnum = k:match(cfg.pattern.listnum)
if listnum thenand table.insertargs[andnum(listnums'list', tonumber(listnum))] endthen
table.insert(listnums, tonumber(listnum))
end
end
end
Line 574 ⟶ 576:
mw.uri.anchorEncode(
args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]
) .. args.argHash
)
else
Line 596 ⟶ 598:
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
:css('padding', '3px0px')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
Line 605 ⟶ 607:
mw.uri.anchorEncode(
args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]
) .. args.argHash
)
else
nav:attr('aria-label', cfg.aria_label .. args.argHash)
end
end
Line 833 ⟶ 835:
and isblank(pargs[andnum('colfooter', 1)]) then
targs[andnum('list', 1)] = targs[andnum('list', 1)] ..
'[[' .. cfg.patterncategory.without_first_col .. ']]'
end