{{Flagg}} (flag general) is a flag template with variable output format. Using Lua instead of the standard mechanism, it allows overriding t
| This is a documentation subpage for Template:Flagg. It may contain usage information, categories and other content that is not part of the original template page. |
| This template uses Lua: |
{{Flagg}} (flag general) is a flag template with variable output format. Using Lua instead of the standard mechanism, it allows overriding the image name and link target, and works even if a country data template for an entity does not exist (without using any expensive functions).
The template is not intended to fully supersede any specific flag templates it can simulate (see below), but can be useful for formats for which no template exists, or if its additional options are needed.
Aliases (alternatives) for each parameter or value are given in square brackets.
The first parameter is an alphabetic code specifying the output format. The first letter concerns the image, the second the separator, and the third the country name. The parameter is fully case-insensitive.
If any position in the parameter value is missing or has a character not corresponding to an option below, the options marked as default will be used; e.g. a first parameter equal to i, i** or izz will be read as isc.
Image (first letter)
| Letter | Meaning | Description | Example |
|---|---|---|---|
| u | unlinked | Image is not linked (default). | {{flagg|uxx|France}} → |
| c | country | Image links to country/entity page. | {{flagg|cxx|France}} → |
| p [f] | prefix/suffix | Image links to country name with prefixed and/or suffixed text (default "Flag of ..."), set using |pref= and |suff= (see below). |
{{flagg|pxx|France}} → |
| i | image page | Image links to file description page; use this for non-public-domain images, for which attribution is required. | {{flagg|ixx|France}} → |
| d | data template | Image links to the used country data template, for use in discussion/documentation. Automatically adds redirect=no if link is a redirect. |
{{flagg|dxx|France}} → |
| x | X mark | No image is displayed. If the second letter is anything other than x, and o is not set, an unlinked transparent image is actually used to preserve the spacing. | {{flagg|xnx|France}} → |
Separator (second letter)
| Letter | Meaning | Description | Example | |
|---|---|---|---|---|
| s | span box | The flag image is put in a fixed-width <span> tag, meaning the country names are aligned in vertical lists; see documentation of {{Flaglist}} (default). | {{flagg|usu|Niger}} → | |
| n | non-breaking space | A non-breaking space ( ) is used, like in most flag templates, including {{flag}}. Note that does not actually prevent wrapping between image and text in all browsers; use w as described below if needed. |
{{flagg|unu|Niger}} → | |
| l | line break | A line break (<br/>) is used as separator. |
{{flagg|ulu|Niger}} → Niger | |
| t | table cell | A table cell separator (two pipes) is used. | Niger | |
| x | X mark | No separator is used. | {{flagg|uxu|Niger}} → | |
Name (third letter)
| Letter | Meaning | Description | Example |
|---|---|---|---|
| c | country | The country name links to the main country/entity page (default). | {{flagg|xxc|Chile}} → Chile
|
| p | prefix/suffix | The country name links to the country page with prefixed or suffixed text (default "Flag of ..."), set using |pref= and |suff= (see below). |
{{flagg|xxp|Chile}} → Chile
|
| f | full prefix/suffix | Same as p, except that the prefix and/or suffix is/are displayed. | {{flagg|xxf|Chile}} → Flag of Chile
|
| b | both country and prefix/suffix | Combined country link and prefix/suffix link: country name links to country page, while prefix and/or suffix link(s) to prefixed/suffixed title. | {{flagg|xxb|Chile}} → Flag of Chile
|
| u | unlinked (cf. {{flagu}}) | The country name is displayed as plain text, without link. | {{flagg|xxu|Chile}} → Chile
|
| d | data template | Country name is linked to the used country data template, for use in discussion/documentation. Automatically adds redirect=no if a redirect is used. |
{{flagg|xxd|Chile}} → Chile
|
| x | X mark | No text is displayed. | {{flagg|xxx|Chile}} →
|
Some additional options can be enabled by appending the following letters to the three-letter code in any order:
| Letter | Description | Example |
|---|---|---|
| a | Adds the country name (the "name" parameter, or if unset the second unnamed parameter) as alt text and mouseover for the image. If |alt= is used for a custom alt/mouseover text, this does not need to be separately set. |
{{flagg|uxxa|Pakistan}} → |
| e | Uses the name set in the country data template (rather than the first parameter) as display name, like in {{flagcountry}} (i.e. expands abbreviated forms). | {{flagg|unue|PAK}} → |
| o | Omits the image and spacing in case the image is an invisible placeholder, i.e., only include the spacing if a flag is displayed. Useful for inline/standalone usages or horizontal lists, where name alignment is not needed. | {{flagg|unuo|Pakistan|image=}} → PakistanCompare with: {{flagg|unu|Pakistan|image=}} → |
| r | Reverses the order of the elements, putting the image to the right of the name; cf. {{flagright}}. Doesn't affect the order of letters in the format code. | {{flagg|uncr|Pakistan}} → Pakistan |
| w | Avoids wrapping by adding <span class="nowrap">...</span> around the output. |
{{flagg|unuw|Pakistan}} → |
The second parameter is the country or entity name. The template attempts to read the flag and link data from "Template:Country data country"; if that does not exist, the same parameter will be used as default country link and no automatic image will be displayed. The parameter also defines the default displayed country name, if the e option above is not used.
|variant= [third unnamed parameter]{{flagg|ixx|Germany|naval}} → |image=|size= [|sz=]|border=|border= can be set to "yes" ["y", "1"] to force a border when excluded by default, or "no" ["n", "0", empty string] to prevent one.|align= [|al=]|width= [|w=]|alt=|ilink=|name=|clink= [|link=]|pref=, |suff=, |plink=|pref= and |suff= set the prefix and suffix to use for the prefix/suffix links (format letters f, p and b). The default, if neither is specified, is "Flag of" as prefix (cf. {{flagof}}) and no suffix. |plink= can be used to override the combined link.|the={{flagg|usf|Philippines|the=1}} → |pthe= if the link needs "the" but the name doesn't, and |nthe= if the name needs it but the link doesn't.|section=|csection= for a section of the country article, and |psection= for a section of the prefixed/suffixed article.|altvar= [|avar=], |age={{flagg|usp|Ireland|avar=ru}} → |age=.|nalign= [|nal=]|align=.|text=|nodata=y{{country data ...}} template, which is useful when the corresponding data template doesn't exist.Formats:
{{flagg|usc|Fiji}} → {{flagg||Fiji}} → {{flagg|pnbr|Fiji}} → Flag of Fiji <span style="display:inline-block;text-align:center;">{{flagg|ilf|Fiji|sz=xl}}</span> → Table format & alignment:
{{flagg|utu|Jamaica}} |
Jamaica | |
{{flagg|utur|Jamaica}} |
Jamaica | |
{{flagg|utu|Jamaica|al=l|nal=l}} |
Jamaica | |
{{flagg|utu|Jamaica|al=c|nal=c}} |
Jamaica | |
{{flagg|utu|Jamaica|al=r|nal=r}} |
Jamaica |
{{flagg|usu|Switzerland}} → {{flagg|usu|Switzerland|al=l}} → {{flagg|usu|Switzerland|al=c}} → {{flagg|usu|Switzerland|al=r}} → Standard image & name parameters:
{{flagg|isc|Myanmar}} → {{flagg|isc|Myanmar|border=}} → {{flagg|isc|Myanmar|1974}} → {{flagg|isc|Myanmar|variant=1974}} → {{flagg|isc|Myanmar|name=Burma|variant=1974}} → {{flagg|isc|Burma|variant=1974}} → {{flagg|isc|Myanmar|sz=30}} → {{flagg|isc|Myanmar|size=30}} → {{flagg|isc|Myanmar|size=30px}} → {{flagg|isc|Myanmar|size=30x18px}} → {{flagg|isc|Myanmar|size=xs}} → {{flagg|isc|Myanmar|size=xl}} → {{flagg|isc|Myanmar|width=30|size=xs}} → {{flagg|isc|Myanmar|image=}} → {{flagg|isc|Myanmar|image=Flag of None.svg}} → {{flagg|isc|Myanmar|image=File:Flag of None.svg}} → Links and altvars:
{{flagg|psp|Egypt}} → {{flagg|psf|Egypt}} → {{flagg|psb|Egypt}} → {{flagg|psb|Philippines|the=1}} → {{flagg|csc|Egypt|section=History}} → {{flagg|csb|Egypt|csection=History}} → {{flagg|psb|Egypt|psection=Kingdom of Egypt (1922–1953)|variant=1922}} → {{flagg|psb|Egypt|plink=List of Egyptian flags}} → {{flagg|psf|Egypt|pref=History of}} → {{flagg|psp|Egypt|suff=at the Olympics}} → {{flagg|psp|Egypt|avar=fb}} → {{flagg|psp|Egypt|avar=football}} → {{flagg|psp|Egypt|avar=fbu|age=20}} → {{flagg|psf|Egypt|avar=navy}} → Non-existing data template: A data template does exist; this documentation needs updating.
These "specialized" templates predate Flagg, and while most do not have options for custom links and images, they are probably faster because they only do two transclusions without invoking Lua.
| Template | Corresponding {{flagg}} syntax |
Example |
|---|---|---|
{{flag|country}} |
{{flagg|unc|country}} |
{{flag|China}} → {{flagg|unc|China}} → |
{{flagbig|country}} |
{{flagg|ulc|country|sz=l}} |
{{flagbig|China}} → China {{flagg|ulc|China|sz=l}} → China |
{{flagc|country}} |
{{flagg|inc|country}} |
{{flagc|China}} → {{flagg|inc|China}} → |
{{flagcountry|country}} |
{{flagg|unce|country}} |
{{flagcountry|CHN}} → {{flagg|unce|CHN}} → |
{{flagdeco|country}} |
{{flagg|uxx|country}} |
{{flagdeco|China}} → {{flagg|uxx|China}} → |
{{flagicon|country}} |
{{flagg|cxx|country}} |
{{flagicon|China}} → {{flagg|cxx|China}} → |
{{flagicon image|image}} |
{{flagg|uxx|image=image}} |
{{flagicon image|Flag of China.svg}} → {{flagg|uxx|image=Flag of China.svg}} → |
{{flaglink|country|suffix}} |
{{flagg|unp|country|suff=suffix}} |
{{flaglink|China|at the Hopman Cup}} → {{flagg|unp|China|suff=at the Hopman Cup}} → |
{{flag+link|prefix|country}} |
{{flagg|unp|country|pref=prefix}} (no existence check) |
{{flag+link|Agriculture in|China}} → {{flagg|unp|China|pref=Agriculture in}} → |
{{flaglist|country}} |
{{flagg|usc|country}} |
{{flaglist|China}} → {{flagg|usc|China}} → |
{{flagof|country}} |
{{flagg|unp|country|sz=l}} |
{{flagof|China}} → {{flagg|unp|China|sz=l}} → |
{{flagright|country}} |
{{flagg|uncr|country}} |
{{flagright|China}} → China {{flagg|uncr|China}} → China |
{{flagu|country}} |
{{flagg|unu|country}} |
{{flagu|China}} → {{flagg|unu|China}} → |
{{noflag|country}} |
{{flagg|xnu|country}} |
{{noflag|China}} → China{{flagg|xnu|China}} → |
{{noflag|[[country]]}} |
{{flagg|xnc|country}} |
{{noflag|[[China]]}} → China{{flagg|xnc|China}} → |
The football templates are used as examples here; other sports that have separate templates work correspondingly.
| Template | Corresponding {{flagg}} syntax |
Example |
|---|---|---|
{{fb|country}} |
{{flagg|unpe|country|avar=fb}} |
{{fb|China}} → {{flagg|unpe|China|avar=fb}} → |
{{fb|country|align=1}} |
{{flagg|uspe|country|avar=fb|al=c}} |
{{fb|China|align=1}} → {{flagg|uspe|China|avar=fb|al=c}} → |
{{fb-big|country}} |
{{flagg|ulpe|country|avar=fb|sz=l}} |
{{fb-big|China}} → China {{flagg|ulpe|China|avar=fb|sz=l}} → China |
{{fb-rt|country}} |
{{flagg|unpre|country|avar=fb}} |
{{fb-rt|China}} → China {{flagg|unpre|China|avar=fb}} → China |
{{fbu|age|country}} |
{{flagg|unpe|country|avar=fbu|age=age}} |
{{fbu|17|China}} → {{flagg|unpe|China|avar=fbu|age=17}} → |
{{fbw|country}} |
{{flagg|unpe|country|avar=fbw}} |
{{fbw|China}} → {{flagg|unpe|China|avar=fbw}} → |
{{fbwu|age|country}} |
{{flagg|unpe|country|avar=fbwu|age=age}} |
{{fbwu|17|China}} → {{flagg|unpe|China|avar=fbwu|age=17}} → |
{{army|country}} |
{{flagg|unfe|country|avar=army}} (no automatic name override) |
{{army|China}} → {{flagg|unfe|China|avar=army}} → |
{{navy|country}} |
{{flagg|unfe|country|avar=navy}} (no automatic name override) |
{{navy|China}} → {{flagg|unfe|China|avar=navy}} → |
{{air force|country}} |
{{flagg|unfe|country|avar=air force}} (no automatic name override) |
{{air force|China}} → {{flagg|unfe|China|avar=air force}} → |
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.