Module:Navbox top and bottom

-- This implements and local p = {}

local function build_navbox(parentArgs, list) local args = {} for argName, value in pairs(parentArgs) do       if value ~= '' then if type(argName) == 'string' then -- shift list numbers by 1 if argName:find('^list[%d]+') then local k = mw.ustring.gsub(argName,'^list([^%d]+)', '%1') argName = mw.ustring.gsub(argName,'^list[%d]+', 'list' .. (tonumber(k) + 1)) end args[argName] = value end end end args['list1padding'] = '0' args['list1'] = list -- Note Navbox.navbox has a kludge to order the parent frame's args -- into a specific order. For now, this is omitted from this module.

local Navbox = require('Module:Navbox') return Navbox._navbox(args) end

function p.top(frame) local args = frame:getParent.args local parts = mw.text.split(build_navbox(args, ''), '') return parts[1] end

function p.bottom(frame) local args = {} local parts = mw.text.split(build_navbox(args, ''), '') return parts[2] end

return p