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 18:50, 25 August 2024 (Renive args). 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 defs = {
	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.getDef(style)
	return defs[style] or defs.default
end

function p.getType(def, type)
	return def[type] or def.default
end

function p.size(frame)
	local args = getArgs(frame)
	return p.getType(p.getDef(args, args.style), args.type);
end

return p