Jump to content

Module:Road data/size/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 07:23, 22 August 2024 (Take a type parameter). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
require("strict")

local p = {}

local getArgs = require('Module:Arguments').getArgs
local format = mw.ustring.format

local sizes = {
	infobox = {
		banner = '72px',
		upright = '72px',
		default = 'x72px'
	},
	small = {
		banner = '40px',
		upright = '40px',
		default = 'x40px'
	},
	list = {
		banner = '32px',
		upright = '32px',
		default = 'x32px'
	},
	rdt = {
		banner = '17px',
		default = 'x17px'
	},
	-- 'jct'
	default = {
		banner = '24px',
		upright = '24px',
		default = 'x24px'
	}
}

function p._size(args)
	local tbl = sizes[args.style] or sizes.default
	return tbl[args.type] or tbl.default
end

function p.size(frame)
	local args = getArgs(frame)
	return p._size(args);
end

return p