local p =
local dir_text =
local noquad =
local valid_dirs = ;local valid_quads = ;
local function contains(list, x) for _, v in pairs(list) do if v
local function get_quad_info(dir, quad) if quad
'2' then return dir_text[dir:sub(1,1)], 'entrance' elseif quad
'4' then return dir_text[dir:sub(2,2)], 'entrance' else error('Invalid argument quad=' .. quad) endend
local function get_alt_text(dir, quads, noonly) noonly = noonly or false if quads
1 then quad_dir, quad_type = get_quad_info(dir, quads:sub(1,1)) local alt_text = quad_dir .. ' ' .. quad_type if not noonly then alt_text = alt_text .. ' only' end return alt_text elseif #quads
quad_type2 then alt_text = quad_dir1 .. ' and ' .. quad_dir2 .. ' ' .. quad_type1 .. 's' elseif quad_dir1
3 then noquad_dir, noquad_type = get_quad_info(dir, noquad[quads]) return 'no ' .. noquad_dir .. ' ' .. noquad_type else error('Invalid length for argument quads=' .. quads) endend
local function get_bullet_fn(quads) if quads
function p._intsym(args) local dir = nil if args['dir'] ~= nil then dir = args['dir'] if not contains(valid_dirs, dir) then error('Invalid input: dir=' .. dir) end end local quads = nil if args['quads'] ~= nil then quads = tostring(args['quads']) if not contains(valid_quads, quads) then error('Invalid input: quads=' .. quads) end end
local text = args['text'] local noonly = args['noonly'] local bullet_link = '24px|link=|' .. get_alt_text(dir, quads, noonly) .. '' if text
function p._intsym_legend(args) local dir = nil if args['dir'] ~= nil then dir = args['dir'] if not contains(valid_dirs, dir) then error('Invalid input: dir=' .. dir) end end local alt_text1 = get_alt_text(dir, '1', true) local alt_text2 = get_alt_text(dir, '2', true) local alt_text3 = get_alt_text(dir, '3', true) local alt_text4 = get_alt_text(dir, '4', true) local quad1 = '24px|link=|' .. alt_text1 .. ' ' .. alt_text1 local quad2 = '24px|link=|' .. alt_text2 .. ' ' .. alt_text2 local quad3 = '24px|link=|' .. alt_text3 .. ' ' .. alt_text3 local quad4 = '24px|link=|' .. alt_text4 .. ' ' .. alt_text4 return quad1 .. ' ' .. quad2 .. ' ' .. quad3 .. ' ' .. quad4end
function p.intsym(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return p._intsym(args)end
function p.intsym_legend(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return p._intsym_legend(args)end
return p