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}} → Lua error in Module:Road_data/parser at line 188: attempt to index local 'args' (a nil value).
local getArgs = require('Module:Arguments').getArgs
local p = {}
local concat = table.concat
local insert = table.insert
local format = mw.ustring.format
local parserModule = require("Module:Road data/parser")
local parser = parserModule.parser
function p._main(args)
local style = args.style
if style == 'infobox' then
return tostring('70')
elseif style == 'small' then
return tostring('40')
elseif style == 'list' then
return tostring('25')
else return tostring('20')
end
end
function p.size(frame)
local args = getArgs(frame)
if parser(route, 'shieldsize') == "upright" then
return p._main(args)
else return p._main(args)
end
end
function p.banner(frame)
local args = getArgs(frame)
return p._main(args)
end
return p