Jump to content

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

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


local defs = {
local function main(args)
local style = args.style
infobox = {
if style == 'infobox' then
banner = '72px',
upright = '72px',
return '72px'
elseif style == 'small' then
default = 'x72px'
return '40px'
},
elseif style == 'list' then
small = {
banner = '40px',
return '32px'
elseif style == 'rdt' then
upright = '40px',
default = 'x40px'
return '17px'
else return '24px'
},
end
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
end


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


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



Revision as of 08:19, 26 August 2024

require("strict")

local p = {}

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

local function main(args)
	local style = args.style
	if style == 'infobox' then
		return '72px'
	elseif style == 'small' then
		return '40px'
	elseif style == 'list' then
		return '32px'
	elseif style == 'rdt' then
		return '17px'
	else return '24px'
	end
end

function p._size(args)
	return main(args)
end

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

return p