编辑“︁
Template:Flagg/doc
”︁(章节)
跳转到导航
跳转到搜索
这是
Flagg
模板的
文档页面
。
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
== Parameters == Aliases (alternatives) for each parameter or value are given in square brackets. === Format (first unnamed parameter) === 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 <code>i</code>, <code>i**</code> or <code>izz</code> will be read as <code>isc</code>. '''First letter: Image''' {|class="wikitable" ! Letter !! Meaning !! Description !! Example |- | <code>u</code> || <u>u</u>nlinked || Image is not linked (default). || {{#invoke:DemoTemplate|flagg|uxx|France}} |- | <code>c</code> || <u>c</u>ountry || Image links to country/entity page. || {{#invoke:DemoTemplate|flagg|cxx|France}} |- | <code>p</code> [<code>f</code>] || <u>p</u>refix/suffix || Image links to country name with prefixed and/or suffixed text (default "Flag of ..."), set using {{para|pref}} and {{para|suff}} (see [[#pref|below]]). || {{#invoke:DemoTemplate|flagg|pxx|France}} |- id="i" | <code>i</code> || <u>i</u>mage page || Image links to file description page; use this for non-public-domain images, for which attribution is required. || {{#invoke:DemoTemplate|flagg|ixx|France}} |- | <code>d</code> || <u>d</u>ata template || Image links to the used country data template, for use in discussion/documentation. Automatically adds <code>redirect=no</code> if link is a redirect. || {{#invoke:DemoTemplate|flagg|dxx|France}} |- id="x" | <code>x</code> || [[X mark]] || No image is displayed. If the second letter is anything other than <code>x</code>, and [[#o|<code>o</code>]] is not set, an unlinked transparent image is actually used to preserve the spacing. || {{#invoke:DemoTemplate|flagg|xnx|France}} |} '''Second letter: Separator''' {|class="wikitable" ! Letter !! Meaning !! Description !! colspan="2"|Example |- id="s" | <code>s</code> || <u>s</u>pan box || The flag image is put in a fixed-width <span> tag, meaning the country names are aligned in vertical lists; see documentation of {{tl|Flaglist}} (default). || colspan="2"|{{#invoke:DemoTemplate|flagg|usu|Niger}} |- id="n" | <code>n</code> || <u>n</u>on-breaking space || A non-breaking space (<code>&nbsp;</code>) is used, like in most flag templates, including {{tl|flag}}. Note that &nbsp; does not actually prevent wrapping between image and text in all browsers; use [[#w|<code>w</code>]] as described below if needed. || colspan="2"|{{#invoke:DemoTemplate|flagg|unu|Niger}} |- id="l" | <code>l</code> || <u>l</u>ine break || A line break (<code><br/></code>) is used as separator. || colspan="2"|{{#invoke:DemoTemplate|flagg|ulu|Niger}} |- id="t" | <code>t</code> || <u>t</u>able cell || A table cell separator (two pipes) is used. || {{#invoke:DemoTemplate|flagg|utu|Niger}} |- | <code>x</code> || X mark || No separator is used. || colspan="2"|{{#invoke:DemoTemplate|flagg|uxu|Niger}} |} '''Third letter: Name''' {|class="wikitable" ! Letter !! Meaning !! Description !! Example |- | <code>c</code> || <u>c</u>ountry || The country name links to the main country/entity page (default). || {{#invoke:DemoTemplate|flagg|xxc|Chile}} |- | <code>p</code> || <u>p</u>refix/suffix || The country name links to the country page with prefixed or suffixed text (default "Flag of ..."), set using {{para|pref}} and {{para|suff}} (see [[#pref|below]]). || {{#invoke:DemoTemplate|flagg|xxp|Chile}} |- id="f" | <code>f</code> || <u>f</u>ull prefix/suffix || Same as <code>p</code>, except that the prefix and/or suffix is/are displayed. || {{#invoke:DemoTemplate|flagg|xxf|Chile}} |- id="b" | <code>b</code> || <u>b</u>oth 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. || {{#invoke:DemoTemplate|flagg|xxb|Chile}} |- | <code>u</code> || <u>u</u>nlinked (cf. {{tl|flagu}}) || The country name is displayed as plain text, without link. || {{#invoke:DemoTemplate|flagg|xxu|Chile}} |- | <code>d</code> || <u>d</u>ata template || Country name is linked to the used country data template, for use in discussion/documentation. Automatically adds <code>redirect=no</code> if a redirect is used. || {{#invoke:DemoTemplate|flagg|xxd|Chile}} |- | <code>x</code> || X mark || No text is displayed. || {{#invoke:DemoTemplate|flagg|xxx|Chile}} |- | <code>*</code> || Add * || Similar to "p", except that an asterisk (*) is added to the text of the link if it goes to a more specific article.|| {{#invoke:DemoTemplate|flagg|xx*|Chile}} |} Some additional options can be enabled by appending the following letters to the three-letter code in any order: {| class="wikitable" ! Letter !! Description !! Example |- id="a" | <code>a</code> || <u>A</u>dds the country name (the "name" parameter, or if unset the second unnamed parameter) as <u>a</u>lt text and mouseover for the image. If [[#alt|{{para|alt}}]] is used for a custom alt/mouseover text, this does not need to be separately set. || {{#invoke:DemoTemplate|flagg|uxxa|Pakistan}} |- | <code>b</code> || <u>B</u>lanks the text portion if a flag is not found. || {{#invoke:DemoTemplate|flagg|uncb|Xanadu}}<br/>Compare with:<br/>{{#invoke:DemoTemplate|flagg|unc|Xanadu}} |- id="e" | <code>e</code> || Uses the name set in the country data template (rather than the first parameter) as display name, like in {{tl|flagcountry}} (i.e. <u>e</u>xpands abbreviated forms). || {{#invoke:DemoTemplate|flagg|unue|PAK}} |- id="f" | <code>f</code> || If the prefixed/suffixed article name doesn't exist, <u>f</u>allback to linking to the non-prefixed/suffixed page. This may be [[:mw:Help:Extension:ParserFunctions#ifexist_limits|expensive]], and the number of time it can be used on single page is limited. || {{#invoke:DemoTemplate|flagg|psff|Egypt|pref=Flag templates in}}<br/>Compare with:<br/>{{#invoke:DemoTemplate|flagg|psf|Egypt|pref=Flag templates in}} |- id="o" | <code>l</code> || Adds the <u>l</u>ink name (as defined by the "image" parameter) as alt text and mouseover for the image. If [[#alt|{{para|alt}}]] is used for a custom alt/mouseover text, this does not need to be separately set. || {{#invoke:DemoTemplate|flagg|cxxl|PAK}}<br/>Compare with:<br/>{{#invoke:DemoTemplate|flagg|cxxa|PAK}} |- | <code>o</code> || <u>O</u>mits 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. || {{#invoke:DemoTemplate|flagg|unuo|Pakistan|image=}}<br/>Compare with:<br/>{{#invoke:DemoTemplate|flagg|unu|Pakistan|image=}} |- id="r" | <code>r</code> || Reverses the order of the elements, putting the image to the <u>r</u>ight of the name; cf. {{tl|flagright}}. Doesn't affect the order of letters in the format code. || {{#invoke:DemoTemplate|flagg|uncr|Pakistan}} |- id="w" | <code>w</code> || Avoids <u>w</u>rapping by adding {{tag|span|params=class="nowrap"}} around the output. || {{#invoke:DemoTemplate|flagg|unuw|Pakistan}} |- id="t" | <code>t</code> || Aligns to the left in a <u>t</u>able. || |} === Entity (second unnamed parameter) === 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|{{mono|e}}]] option above is not used. === Image parameters === ;{{para|variant}} [third unnamed parameter] :Specifies a variant flag image, as defined and documented in each entity's data template. For example, {{#invoke:DemoTemplate|flagg|ixx|Germany|naval}} uses the "naval" variant of [[Template:Country data Germany]]. ;{{para|image}} :Custom image name, with or without the "File:" namespace prefix. Can be used if the wanted image is not available as variant for the entity (you can alternatively request it be added at the respective data template's talk page), or if no data template exists. Set to "none" ["blank", empty string] to use an unlinked transparent image (functionally identical to the [[#x|{{mono|x}}]] format). ;{{para|size}} [{{para|sz}}] :Sets the image size; default is 23×15 pixels (larger for [[:Category:Country data templates with distinct default size|some entities]]). You can use an explicit size in pixels (e.g. 30x20px; the "px" suffix is optional) or one of the relative sizes "xs" (half the default dimensions), "s", "m", "l" and "xl" (twice the default size). ;{{para|border}} :By default, the flag icon includes a border, except if it is disabled in the entity's country data template. {{para|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. ;{{anchor|align}}{{para|align}} [{{para|al}}] :Set to "left" ["l"], "center" ["centre", "c", "middle", "m"] or "right" ["r"] to set the alignment of the image for the span box ([[#s|{{mono|s}}]]) and table cell ([[#t|{{mono|t}}]]) formats. For {{mono|t}}, the default is center; for {{mono|s}}, it is right-aligned if [[#r|{{mono|r}}]] is set, else left-aligned. ;{{para|width}} [{{para|w}}] :Sets the width of the span box surrounding the image for the span box ([[#s|{{mono|s}}]]) format, in pixels, without the "px" suffix. The default is calculated by [[Module:Flaglist]] and depends on the image size. ;{{anchor|alt}}{{para|alt}} :Sets alt text and mouseover text for the flag image, if it is for information rather than just decoration. If the wanted text is equal to the entity name, use the [[#a|{{mono|a}}]] option described above. ;{{para|ilink}} :Overrides the link target of the image (only use if none of the image formats above allow linking to the desired page). ;{{para|noredlink|no}} :Displays a red link to the missing country data template instead of a placeholder image. Defaults to "yes" (no red link displayed). ;{{para|missingcategory|''category name''}} :Adds the page to ''category name'' if the image if the country data is missing. === Text and link parameters === ;{{para|name}} :Changes the displayed country name. Note that with the [[#f|{{mono|f}}]] format, this includes the prefix and/or suffix. ;{{para|clink}} [{{para|link}}] :Overwrites the link to the country article; this is also used to construct the prefix/suffix link for the {{mono|f}}, {{mono|p}} and {{mono|b}} options. ;{{anchor|pref}}{{para|pref}}, {{para|suff}}, {{para|plink}} :{{para|pref}} and {{para|suff}} set the prefix and suffix to use for the prefix/suffix links (format letters {{mono|f}}, {{mono|p}} and {{mono|b}}). The default, if neither is specified, is "Flag of" as prefix (cf. {{tl|flagof}}) and no suffix. {{para|plink}} can be used to override the combined link. ;{{para|the}} :Set to "yes" ["y", "1"] to include the article "the" before the country name in the prefix/suffix links. Example: {{#invoke:DemoTemplate|flagg|usf|Philippines|the=1}}. Use {{para|pthe}} if the link needs "the" but the name doesn't, and {{para|nthe}} if the name needs it but the link doesn't. ;{{para|section}} :Links to a section of the linked article without displaying the section name. If both a country link and a prefix/suffix link are used, use {{para|csection}} for a section of the country article, and {{para|psection}} for a section of the prefixed/suffixed article. ;{{para|altvar}} [{{para|avar}}], {{para|age}} :Enables using one of a set of standard suffixes for linking to sports teams and militaries. The altvar and suffix data is loaded from [[Module:Flagg/Altvar data]]. The possible parameter values are the base names of the corresponding specialized templates; alias values from full sports names exist (see examples below and data page). For some entities this also changes the image to a variant specific to a sport or military branch; for example, {{#invoke:DemoTemplate|flagg|usp|Ireland|avar=ru}} uses the [[List of flags of Ireland#Sporting flags|IRFU flag]] to represent the Irish rugby union team. For youth teams in some sports (see the data page), the age limit must be additionally set using {{para|age}}. ;{{para|nalign}} [{{para|nal}}] :Sets the alignment of the text in table cell format ({{mono|t}}). The default is left; the possible values are the same as for [[#align|{{para|align}}]]. ;{{para|text}} :Overrides the entire text; only use when necessary for any nonstandard formats. Alternatively, you can set the third letter of the format parameter to {{mono|x}} (no text) and add custom text outside the template. ;{{para|nodata|y}} :Overrides attempts to use the corresponding {{tld|country data ...}} template, which is useful when the corresponding data template doesn't exist. ;{{para|pref2}}, {{para|suff2}}, {{para|plink2}}, {{para|psection2}} : If the f extra is specified, and the prefix/suffixed article name being linked to doesn't exist, then use these parameters as an alternate prefix/suffix, and check if it exists as well. (If it still doesn't exist, then fall back to the non-prefixed/suffixed page as normal). This may be [[:mw:Help:Extension:ParserFunctions#ifexist_limits|expensive]], and the number of time it can be used on single page is limited.
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
模板
讨论
大陆简体
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息