Changes

Jump to: navigation, search

Module:Navbox

669 bytes added, 01:48, 4 May 2017
update from Module:Navbox/sandbox per Template talk:Navbox#Merging nowrap navbox to implement nowrapitems=yes to nowrap listN + above + below text
end
local function addNewlineprocessItem(sitem, nowrapitems) if sitem:sub(1, 2) == '{|' then -- 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 == 'yes' then local lines = {} for line in (item .. '\n'):gmatch('([^\n]*)\n') do local prefix, content = line:match('^([*:;#]+)%s*(.*)') or s if prefix and not content:match('^{|<span class="nowrap">') then return line = prefix .. '\n<span class="nowrap">' .. s content .. '</span>' end table.insert(lines, line) end item = table.concat(lines, '\n') elseend if item:match('^[*:;#]') then return s'\n' .. item ..'\n'
end
return item
end
:css('font-size', '114%')
:css('margin', '0 4em')
:wikitext(addNewlineprocessItem(args.title))
end
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(addNewlineprocessItem(args.above, args.nowrapitems))
end
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(addNewlineprocessItem(args.below, args.nowrapitems))
end
:attr('rowspan', 2 * #listnums - 1)
:tag('div')
:wikitext(addNewlineprocessItem(args.imageleft))
end
:tag('div')
:css('padding', (index == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
:wikitext(addNewlineprocessItem(listText, args.nowrapitems))
if index == 1 and args.image then
:attr('rowspan', 2 * #listnums - 1)
:tag('div')
:wikitext(addNewlineprocessItem(args.image))
end
end
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
for i_, cat in ipairs(getTrackingCategories()) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
args = navboxArgs
for k, v _ in pairs(args) do if type(k) == 'string' then local listnum = ('' .. k):match('^list(%d+)$') if listnum then table.insert(listnums, tonumber(listnum)) end end
end
table.sort(listnums)
Anonymous user

Navigation menu