Module:Border

require('strict')

local p = {} --p stands for package

local getArgs = require('Module:Arguments').getArgs local make_style_string = require('Module:Optional style').make_style_string local CSS_unit = require('Module:CSS unit')._CSS_unit

function p.border_start(frame) local args = getArgs(frame) -- style arg aliases args['maxwidth'] = args['max-width'] or args.maxwidth or args[2] args.bstyle = args.bstyle or args[3] args.bthickness = args.bthickness or args[4] args.color = args.color or args[5] args.bgcolor = args.bgcolor or args[6] args.align = args.align or args[7] args.padding = args.padding or args[9] args.position = args.position or args[8] local styleArgs = { ['max-width'] = args.maxwidth or 'none', ['display'] = args.display or 'block', ['box-sizing'] = 'border-box', ['border'] = (args.bstyle or 'solid') .. ' ' .. (args.bthickness or '1px') .. ' ' .. (args.color or '#000000'), ['background-color'] = args.bgcolor or '#FFFFFF', ['color'] = '#202122', ['text-align'] = args.align or 'left', ['padding'] = args.padding or '5px', ['style'] = args.style }	if args.position == 'left' then -- do nothing elseif args.position == 'right' then styleArgs['position'] = 'relative' styleArgs['margin-left'] = 'auto' else styleArgs['margin-left'] = 'auto' styleArgs['margin-right'] = 'auto' end local styleParam = make_style_string(styleArgs) local divOpen = ' ' local trackingCats = {} if CSS_unit({args.maxwidth}) == 'px' then table.insert(trackingCats, '') end for k, v in pairs({'maxwidth', 'display', 'bstyle', 'bthickness', 'color', 'bgcolor', 'align', 'padding', 'style'}) do		if args[v] then table.insert(trackingCats, '') end end return divOpen .. table.concat(trackingCats) end

local function border_end return ' ' end

function p.border(frame) return p.border_start(frame) .. (getArgs(frame)[1] or '') .. border_end end

return p