Jump to content

Module:Road data/size/sandbox: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Syncing sandbox code with main template (sync-template-sandbox.js)
Specify upright vs default here
Tag: Reverted
Line 6: Line 6:
local format = mw.ustring.format
local format = mw.ustring.format


local function main(args)
local sizes = {
infobox = {
local style = args.style
upright = '72px',
if style == 'infobox' then
return '72px'
default = 'x72px'
},
elseif style == 'small' then
small = {
return '40px'
upright = '40px',
elseif style == 'list' then
return '32px'
default = 'x40px'
},
elseif style == 'rdt' then
list = {
return '17px'
upright = '32px',
else return '24px'
default = 'x32px'
end
},
end
rdt = {
upright = '17px',
default = '17px'
},
-- 'jct'
default = {
upright = '24px',
default = 'x24px'
}
}


function p._size(args)
function p._size(args)
return (sizes[args.style] or sizes.default)[args.upright and 'upright' or 'default']
return main(args)
end
end



Revision as of 07:09, 22 August 2024

require("strict")

local p = {}

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

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

function p._size(args)
	return (sizes[args.style] or sizes.default)[args.upright and 'upright' or 'default']
end

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

return p