Module:Sandbox/XanonymusX/Navbox explained

---- This module implements --

local p =

local navbar = require('Module:Navbar')._navbarlocal getArgs -- lazily initialized

local argslocal borderlocal listnumslocal ODD_EVEN_MARKER = '\127_ODDEVEN_\127'local RESTART_MARKER = '\127_ODDEVEN0_\127'local REGEX_MARKER = '\127_ODDEVEN(%d?)_\127'

local function striped(wikitext) -- Return wikitext with markers replaced for odd/even striping. -- Child (subgroup) navboxes are flagged with a category that is removed -- 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 = '' if border

'subgroup' and args.orphan ~= 'yes' then -- No change; striping occurs in outermost navbox. return wikitext .. orphanCat end local first, second = 'odd', 'even' if args.evenodd then if args.evenodd

'swap' then first, second = second, first else first = args.evenodd second = first end end local changer if first

second then changer = first else local index = 0 changer = function (code) if code

'0' then -- Current occurrence is for a group before a nested table. -- Set it to first as a valid although pointless class. -- The next occurrence will be the first row after a title -- in a subgroup and will also be first. index = 0 return first end index = index + 1 return index % 2

1 and first or second end end local regex = orphanCat:gsub('([%[%]])', '%%%1') return (wikitext:gsub(regex, ):gsub(REGEX_MARKER, changer)) -- omits gsub countend

local function processItem(item, nowrapitems) if item:sub(1, 2)

'

parm=x in a template. return '\n' .. item ..'\n' end if not item:match ("