Jump to content

Module:Road data/size

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Fredddie (talk | contribs) at 09:19, 12 February 2021 (create). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

local SANDBOX = false
local SANDBOX_SUFFIX = SANDBOX and '/sandbox' or ''

local concat = table.concat
local insert = table.insert
local format = mw.ustring.format
local getArgs = require('Module:Arguments').getArgs -- Import module function to work with passed arguments
local parserModule = require("Module:Road data/parser" .. SANDBOX_SUFFIX)
local parser = parserModule.parser
local defaultShieldSize = 20
local shieldScale = args.scale or 1

local function shield(args)
	if parser(args, 'style') == 'upright' then
		return (defaultShieldSize * shieldScale)
		else return "x"..(defaultShieldSize * shieldScale)
	end
end

function p._size(args)
	local shield = shield(args)
	local container = shield
	return tostring(shield)
end

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