Module:Flag/doc
Appearance
| This is a documentation subpage for Module:Flag. It may contain usage information, categories and other content that is not part of the original module page. |
| This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected. |
| This Lua module is used on approximately 358,000 pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
| This module depends on the following other modules: |
Lua-native alternative to popular flag templates. Can be used to reduce post-expand include size of pages with lots of templates, since it avoids calling multilevel templates.
Usage
- {{flag}} → {{#invoke:flag|}}
- {{flagcountry}} → {{#invoke:flag|country}}
- {{flagdeco}} → {{#invoke:flag|deco}}
- {{flagicon}} → {{#invoke:flag|icon}}
- {{flag+link}} → {{#invoke:flag|+link}}
- {{flag athlete}} → {{#invoke:flag|athlete}}
- {{flag medalist}} → {{#invoke:flag|medalist}}
Examples
| Template | Module | ||||
|---|---|---|---|---|---|
| Code | Output | PEIS | Code | Output | PEIS |
{{flag|CHN}} |
443b | {{#invoke:flag||CHN}} |
128b | ||
{{flagcountry|CHN}} |
577b | {{#invoke:flag|country|CHN}} |
128b | ||
{{flagdeco|CHN}} |
452b | {{#invoke:flag|deco|CHN}} |
107b | ||
{{flagicon|CHN}} |
548b | {{#invoke:flag|icon|CHN}} |
117b | ||
{{flag+link|History of|CHN}} |
663b | {{#invoke:flag|+link|History of|CHN}} |
139b | ||
{{flag athlete|Andy Murray|GBR}} |
617b | {{#invoke:flag|athlete|Andy Murray|GBR}} |
210b | ||
{{flag medalist|Andy Murray|GBR}} |
Andy Murray |
469b | {{#invoke:flag|medalist|Andy Murray|GBR}} |
Andy Murray |
129b |
Caveats
When used inside a template, parameters from that template are passed to the module. This can be useful in some situations, but can lead to conflicts (for example, if the parent template has a parameter |country= that is unrelated to the flag it is supposed to display). To prevent this behavior, add the |frameonly= parameter to the module call, e.g. {{#invoke:flag|deco|CHN|frameonly=true}}.