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)
Backwards compat with current format
Line 6: Line 6:
local format = mw.ustring.format
local format = mw.ustring.format


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


local nonUpright = {
jdt = true
}

-- Lua exports
function p._size(args)
function p._size(args)
return main(args)
return styles[args.style] or styles.default
end

function p._ignoreUpright(style)
return nonUpright[style] or false
end
end


-- Wikitext exports
function p.size(frame)
function p.size(frame)
local args = getArgs(frame)
local args = getArgs(frame)

Revision as of 08:32, 26 August 2024

require("strict")

local p = {}

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

local styles = {
	infobox = '72px',
	small = '40px',
	list = '32px',
	rdt = '17px',
	-- jct
	default = '24px'
}

local nonUpright = {
	jdt = true
}

-- Lua exports
function p._size(args)
	return styles[args.style] or styles.default
end

function p._ignoreUpright(style)
	return nonUpright[style] or false
end

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

return p