Module:Road data/size
Appearance
![]() | This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
![]() | 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}}
→ x20px
local getArgs = require('Module:Arguments').getArgs
local p = {}
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('70px')
elseif style == 'small' then
return tostring('40px')
elseif style == 'list' then
return tostring('25px')
else return tostring('20px')
end
end
function p.size(frame)
local args = getArgs(frame)
if parser(args, 'shieldsize') == "upright" then
return p._main(args)
else return "x" .. p._main(args)
end
end
function p.banner(frame)
local args = getArgs(frame)
return p._main(args)
end
return p