Module:Road data/size
Appearance
| This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing. |
| This module is currently protected from editing. See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected. |
| This Lua module is used on approximately 18,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
This module contains common shield sizes for use when displaying highway shields.
Lua usage
Function: _size
args- A table of arguments.style- The shield style to get the size for.
Wikitext usage
Function: size
|style=- The shield style to get the size for.
Example
{{#invoke:Road data/size|size|style=jct}} → x20
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 function defaultShieldSize(frame, style)
local args = getArgs(frame)
if args.style == 'infobox' then
return tostring('70')
elseif args.style == 'small' then
return tostring('40')
elseif args.style == 'list' then
return tostring('25')
else return tostring('20')
end
end
function p.size()
local args = getArgs(frame)
standard = "x" .. defaultShieldSize(frame)
upright = defaultShieldSize(frame)
--[[ if parser(route, 'shieldSize') == 'upright' then
return upright
else]] return standard
-- end
end
function p.bannerSize()
local args = getArgs(frame)
banner = defaultShieldSize(frame)
return banner
end
return p