Template:F/doc: Difference between revisions
More actions
m typo |
m new design |
||
| Line 1: | Line 1: | ||
{{TemplateBox | {{TemplateBox | ||
|1=1 | |1=1 | ||
|1d=file name: name of the file, without | |1d=file name: name of the file, with or without namespace | ||
|1stat=required | |||
|2=2 | |2=2 | ||
|2d=display name: any text. Default is the file name (par #1) | |2d=display name: any text<ref name="b"/>. Default is the file name (par #1) | ||
|2stat=optional- | |||
|3=3 | |3=3 | ||
|3d=pixel size: numeric value. The picture is displayed inline in this size <ref name="a">It is ''not possible'' to display images of other Wikipedias - only when the files are stored in the Commons</ref> | |3d=pixel size: numeric value. The picture is displayed inline in this size <ref name="a">The size may be e.g. <code>96</code> or <code>60x16</code>. It is '''''not possible''''' to display images of other Wikipedias - only when the files are stored in the Commons. </ref> | ||
|3stat=optional- | |||
|4=4 | |4=4 | ||
|4d='''b'''<ref name="b">Any of | |4d='''b'''<ref name="b">Parameter #1 can only hold the filename; an alternate text can only be passed with parameter #2, and the display-size only with parameter #3. Other codes are not fixed<!--to a parameter position-->.<br> | ||
Any of the codes (b, l, n, Z) can be passed in any sequence, each as an argument for one of the parameters either #2, #4, #5, #6 or #7: <tt><nowiki>{{F|X.jpg||16|b|l|n}}</nowiki></tt> is equivalent to <tt><nowiki>{{F|X.jpg|n|16|l|b}}</nowiki></tt>.<br>"b", "l" or "n" may even be coded at the position of parameter #3 when no pixel size is specified there, or of parameter #2 when no text is passed.<br>When it is required to display a text of one character equal to "b", "l", "n" or "Z" or a FFL it can be distinguished from such a code by an expansion, e.g. with <<nowiki/>nowiki/>.</ref> (lowercase B) ''to draw a '''''b'''order'' around the displayed picture'' | |||
|4stat=optional- | |4stat=optional- | ||
|5=5 | |5=5 | ||
| Line 17: | Line 21: | ||
|6stat=optional- | |6stat=optional- | ||
|7=7 | |7=7 | ||
|7d=''' | |7d='''Z'''<ref name="b" /> (uppercase Z) to suppress the display of the file name | ||
|7stat=optional- | |7stat=optional- | ||
|8=8 | |||
|8d=''File Function Letter<ref name="b"/><ref>A ''File Function Letter'' can be passed only with parameter either #2 or #3.</ref>: different functions can be performed | |||
|8stat=optional- | |||
| | |9=t= | ||
| | |9d=any text string, used <!--as a separator--> between displayed file name and displayed image | ||
|9def=<span style="color:#777">&nbsp;</span> | |||
|9stat=optional- | |9stat=optional- | ||
|name= | |10=l= | ||
|10d=language code ({{W|ISO 639-1|ISO 639}}), if the file is in another Wikipedia <ref name="a" /><br /><!--This parameter -->may specify e.g. "l=b:es" for an image of the {{W||Spanish Wikibooks|b:es}},<br>or e.g. "l=s:it" for image {{F|Pallot1.svg|l=s:it}} in {{W||Italian Wikisource|s:it}} | |||
|10stat=optional- | |||
|11=lang= | |||
|11d=language code ({{W|ISO 639-1|ISO 639}}), to display a translated version when<br> the SVG file [[Commons:Translation_possible/Learn_more#Multiple translations within one SVG file|contains translations]] using SVG <switch> elements. | |||
|11stat=optional- | |||
|name=F | |||
|desc=<big>Establishes a link to the file whose name is given in par #1 and displays the name without the prefix "File:".</big><br /> | |desc=<big>Establishes a link to the file whose name is given in par #1 and displays the name without the prefix "File:".</big><br /> | ||
Instead of the file name, any text given in par #2 can be displayed.<br /> | |||
The file itself (the image) can be displayed at any size inline, after the name or left of it.<br /> | |||
Additional possibilities: | Additional possibilities: | ||
*It is possible to avoid the link and display the plain name of par #1 (or par #2). | |||
*It is possible to avoid any display of the name but display the image. | |||
*It is possible to avoid the link and display | |||
* | |||
*The displayed image can be surrounded by a border. | *The displayed image can be surrounded by a border. | ||
Beside of these standard usages exist extended possibilities, see below. | |||
|namespace=File | |namespace=File | ||
|usergroup=all | |usergroup=all | ||
|i18n-desc=<!--The template does not generate any localizable text.--> | |||
|usage-notes=The parameters "n" and "l" allow better formatting, e.g. to get equal-wide rows when arranging several lines with displayed images — see the two examples. | |usage-notes=The parameters "n" and "l" allow better formatting, e.g. to get equal-wide rows when arranging several lines with displayed images — see the two examples. | ||
|seealso={{tl2|File|…}} | <!--|seealso={{tl2|File|…}}--> | ||
}} | }} | ||
== Examples == | == Examples == | ||
{{F|Flag of Buddhism.svg|''Buddhist flag''|3=64}} — {{F|Flag of Buddhism.svg|''Buddhist flag''|3=64|4=b|5=l}} (bordered) | === Standard usage === | ||
{| class="wikitable" | |||
! Syntax || Code || Example || | |||
|- | |||
| {{Tle|t=F|file name}} || <nowiki>{{F|SVG Simple Icon.svg}}</nowiki> || {{F|SVG Simple Icon.svg}} ||is the simplest form; it displays the file name as a link to the file. | |||
|- | |||
| {{Tle|t=F|file name|any text}}|| <nowiki>{{F|SVG Simple Icon.svg|example}}</nowiki> || {{F|SVG Simple Icon.svg|example}} || displays the text string of the 2{{exp|nd}} parameter as a link to the file. | |||
|- | |||
| {{Tle|t=F|file name|<nowiki/>|size}}|| <nowiki>{{F|SVG Simple Icon.svg||16}}</nowiki> || {{F|SVG Simple Icon.svg||16}} || displays first the file name, and then the image in ''size'' px<ref name="a" /> | |||
|- | |||
| {{Tle|t=F|file name|any text|size}} || <nowiki>{{F|SVG Simple Icon.svg|SVG|16x16}}</nowiki> || {{F|SVG Simple Icon.svg|SVG|16x16}} || is the same but ''any text'' is displayed instead of the file name. | |||
|} | |||
<!-- don't know why the next headline doesn't do --> | |||
=== Extended usage === | |||
When with a "size" in parameter #3 the image display is requested, | |||
with the parameters <code>b</code> and <code>l</code> additional formatting can be performed.<br> | |||
The one-letter parameters can be specified in any sequence with every parameter #4 to #7 or #2, e.g <tt>4=b</tt> and <tt>6=l</tt>. | |||
* <code>b</code> draws a '''<u>b</u>'''order around the image. This can be useful to show the extensions of the image. | |||
* <code>l</code> displays the image <u>'''l'''</u>eft of the name. This option allows a better formatting, e.g. when more files are displayed in a list and the file names are of different length.<br>{{Tle|t=F|file name|<nowiki/>|size|l}} to display the file left of the name. | |||
* <code>n</code>: Independent whether the image is displayed or not, the parameter <code>n</code> let display plain text instead of the link. This is sometimes useful for better formatting. | |||
:Note: <code>n</code> can as well be specified with every parameter #4 to #7. When no display of the image is required, <code>n</code> can also be specified with parameter #3; when parameter #2 is not needed for a display text, <code>n</code> can even be specified with parameter #2 (to distinguish a ''text of one character'' from a ''one-character-code'', the text may need to be expanded e.g. with <<nowiki/>nowiki/>).<br>{{Tle|t=F|file name|any text|size|b|l|n}} is an example for usage of these formatting characters. | |||
* <code>t=</code>: When the image is displayed either left or right of the displayed file name, with <code>t=</code> any text can be defined to separate the two items. It will replace the default separator <code>:&nbsp;</code> (or <code>&nbsp;</code> with option <tt>l</tt>). | |||
* <code>Z</code>: When an image should be displayed ''without showing the file name'', this can be achieved by setting the character "Z". Parameter #1 specifies the file name, parameter #3 the size; therefore <code>Z</code> can be set by either parameter #4 to #7 or the not needed parameter #2. Of course it is of no use to combine <tt>Z</tt> with <tt>l</tt> or <tt>n</tt> but it won't do any harm.<br>E.g. the sequence {{Tle|t=F|X.svg|Z|10|b}}{{Tle|t=F|X.svg|b|16|Z}}{{Tle|t=F|X.svg|Z|10|b}} will show {{F|X.svg|Z|10|b}}{{F|X.svg|b|16|Z}}{{F|X.svg|Z|10|b}} | |||
<!-- | |||
{{F|Flag of Buddhism.svg|''Buddhist flag''|3=64}} — {{F|Flag of Buddhism.svg|''Buddhist flag''|3=64|4=b|5=l}} (bordered)--> | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
|<nowiki>{{F}}</nowiki> ||{{F}} || without any parameter | |<nowiki>{{F}}</nowiki> ||{{F}} || without any parameter: error display | ||
|- | |- | ||
|<nowiki>{{F|Yes check.svg}}</nowiki> ||{{F|Yes check.svg|}} || only link | |<nowiki>{{F|Yes check.svg}}</nowiki> ||{{F|Yes check.svg|}} || only link | ||
| Line 56: | Line 100: | ||
|<nowiki>{{F|Yes check.svg||16|b}}</nowiki> ||{{F|Yes check.svg||16|b}} || bordered | |<nowiki>{{F|Yes check.svg||16|b}}</nowiki> ||{{F|Yes check.svg||16|b}} || bordered | ||
|- | |- | ||
|<nowiki>{{F|Yes_check.svg||16|l}}</nowiki> ||{{F|Yes_check.svg||16|l}} {{0}} || left of name <small>(as in "other versions" of [[:File:Symbol unrelated.svg]].)</small> | |<nowiki>{{F|Yes_check.svg||16|l}}</nowiki> ||<span>{{F|Yes_check.svg||16|l|tt=}}</span> {{0}} || left of name <small>(as in "other versions" of [[:File:Symbol unrelated.svg]].)</small> | ||
|} | |||
=== Language codes === | |||
The named parameter <code>l=</code> enables interwiki access. Files in any Wikipedia, Wikisource, Wikibooks etc can be addressed by a link, but it is <u>not possible to display images from outside of Commons</u> due to technical restrictions. | |||
The named parameter <code>lang=</code> allows to use the ''language switch'' option:<br> | |||
The file {{F|France Population Pyramid-2010.svg}} contains many languages. With {{Tle|t=F|France Population Pyramid-2010.svg|<nowiki/>|160 |p4=lang|''xx''}} the translated versions can be shown:<br><br> | |||
{{F|France Population Pyramid-2010.svg|arabic|160|lang=ar}} {{0|000}} {{F|France Population Pyramid-2010.svg|ivrit|160|lang=he}} {{0|000}} {{F|France Population Pyramid-2010.svg|korean|160|lang=ko}} {{0|000}} {{F|France Population Pyramid-2010.svg|japan|160|lang=ja}} {{0|000}} {{F|France Population Pyramid-2010.svg|cyrill|160|lang=ru}} | |||
=== File Function Letters === | |||
This option is completely different from the description above, a value is returned instead of displaying something. By invoking the [[Module:File]] various functions can be performed. While parameter #1 specifies the file, the <tt>File Function Letter</tt> must be specified with parameter #2 or #3. Such a FFL has precedence, additional parameter settings are ignored.<br> | |||
Except of the mere string operations <tt>F</tt> and <tt>X</tt>, for files ''outside the commons none'' of the File Functions can be performed. | |||
{| class="wikitable" | |||
|- | |||
! FFL !! function !! returned result | |||
|- | |||
| {{0}}<tt>C</tt> || count || number of file pages | |||
|- | |||
| {{0}}<tt>D</tt> || date || work date, formatted | |||
|- | |||
| {{0}}<tt>F</tt> || file name || name without extension | |||
|- | |- | ||
|< | | {{0}}<tt>X</tt> || extension || extension without name | ||
|- | |||
| {{0}}<tt>I</tt> || ifexist || "true" if file exists | |||
|- | |||
| {{0}}<tt>S</tt> || size || file size in bytes | |||
|- | |||
| {{0}}<tt>H</tt> || height || height in pixel | |||
|- | |||
| {{0}}<tt>W</tt> || width || width in pixel | |||
|- | |||
| {{0}}<tt>V</tt> || valid? || error count from W3C validation | |||
|- | |||
| {{0}}<tt>P</tt> || page size || size of file description page in bytes | |||
|} | |} | ||
Example: {{F|Flag of Buddhism.svg|Buddhist flag|32|l|t= file name: }} ({{uc:{{F|Flag of Buddhism.svg|X}}}} file, nominally {{F|Flag of Buddhism.svg|W}} × {{F|Flag of Buddhism.svg|H}} pixels, file size: {{F|Flag of Buddhism.svg|S}} bytes.) | |||
{{F| | <div/><br clear=both> <!-- Don't know why this headline doesn't do --> | ||
== Notes == | |||
== Notes == | |||
<references /> | <references /> | ||
<includeonly> | <includeonly> | ||
Revision as of 18:17, 2 March 2015
Establishes a link to the file whose name is given in par #1 and displays the name without the prefix "File:".
Instead of the file name, any text given in par #2 can be displayed.
The file itself (the image) can be displayed at any size inline, after the name or left of it.
Additional possibilities:
- It is possible to avoid the link and display the plain name of par #1 (or par #2).
- It is possible to avoid any display of the name but display the image.
- The displayed image can be surrounded by a border.
Beside of these standard usages exist extended possibilities, see below.
Usage
{{F |1= }}
The parameters "n" and "l" allow better formatting, e.g. to get equal-wide rows when arranging several lines with displayed images — see the two examples.
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
1 | file name: name of the file, with or without namespace | empty | required | |
2 | display name: any text[1]. Default is the file name (par #1) | empty | optional | |
3 | pixel size: numeric value. The picture is displayed inline in this size [2] | empty | optional | |
4 | b[1] (lowercase B) to draw a border around the displayed picture | empty | optional | |
5 | l[1] (lowercase L) to display the image left of the file name | empty | optional | |
6 | n[1] (lowercase N) to display the name not-linking to the file | empty | optional | |
7 | Z[1] (uppercase Z) to suppress the display of the file name | empty | optional | |
8 | File Function Letter[1][3]: different functions can be performed | empty | optional | |
t= | any text string, used between displayed file name and displayed image | | optional | |
l= | language code (ISO 639), if the file is in another Wikipedia [2] may specify e.g. "l=b:es" for an image of the Spanish Wikibooks, or e.g. "l=s:it" for image Pallot1.svg in Italian Wikisource | empty | optional | |
lang= | language code (ISO 639), to display a translated version when the SVG file contains translations using SVG <switch> elements. | empty | optional | |
Additional information
The template is intended to be used in the following namespaces: the File namespace
The template is intended to be used by the following user groups: all users
Examples
Standard usage
| Syntax | Code | Example | |
|---|---|---|---|
| {{ F | file name }} | {{F|SVG Simple Icon.svg}} | SVG Simple Icon.svg | is the simplest form; it displays the file name as a link to the file. |
| {{ F | file name | any text }} | {{F|SVG Simple Icon.svg|example}} | example | displays the text string of the 2nd parameter as a link to the file. |
| {{ F | file name | | size }} | {{F|SVG Simple Icon.svg||16}} | SVG Simple Icon.svg: |
displays first the file name, and then the image in size px[2] |
| {{ F | file name | any text | size }} | {{F|SVG Simple Icon.svg|SVG|16x16}} | SVG: |
is the same but any text is displayed instead of the file name. |
Extended usage
When with a "size" in parameter #3 the image display is requested,
with the parameters b and l additional formatting can be performed.
The one-letter parameters can be specified in any sequence with every parameter #4 to #7 or #2, e.g 4=b and 6=l.
bdraws a border around the image. This can be useful to show the extensions of the image.ldisplays the image left of the name. This option allows a better formatting, e.g. when more files are displayed in a list and the file names are of different length.
{{ F | file name | | size | l }} to display the file left of the name.
n: Independent whether the image is displayed or not, the parameternlet display plain text instead of the link. This is sometimes useful for better formatting.
- Note:
ncan as well be specified with every parameter #4 to #7. When no display of the image is required,ncan also be specified with parameter #3; when parameter #2 is not needed for a display text,ncan even be specified with parameter #2 (to distinguish a text of one character from a one-character-code, the text may need to be expanded e.g. with <nowiki/>).
{{ F | file name | any text | size | b | l | n }} is an example for usage of these formatting characters.
t=: When the image is displayed either left or right of the displayed file name, witht=any text can be defined to separate the two items. It will replace the default separator: (or with option l).
Z: When an image should be displayed without showing the file name, this can be achieved by setting the character "Z". Parameter #1 specifies the file name, parameter #3 the size; thereforeZcan be set by either parameter #4 to #7 or the not needed parameter #2. Of course it is of no use to combine Z with l or n but it won't do any harm.
E.g. the sequence {{ F | X.svg | Z | 10 | b }}{{ F | X.svg | b | 16 | Z }}{{ F | X.svg | Z | 10 | b }} will show
| {{F}} | no name | without any parameter: error display |
| {{F|Yes check.svg}} | Yes check.svg | only link |
| {{F|Yes check.svg||n}} | Yes check.svg | only name |
| {{F|Yes check.svg||16|n}} | Yes check.svg: |
no link (as in "other versions" of File:Arrow-C.svg.) |
| {{F|Yes check.svg||16|b}} | Yes check.svg: |
bordered |
| {{F|Yes_check.svg||16|l}} | left of name (as in "other versions" of File:Symbol unrelated.svg.) |
Language codes
The named parameter l= enables interwiki access. Files in any Wikipedia, Wikisource, Wikibooks etc can be addressed by a link, but it is not possible to display images from outside of Commons due to technical restrictions.
The named parameter lang= allows to use the language switch option:
The file France Population Pyramid-2010.svg contains many languages. With {{ F | France Population Pyramid-2010.svg | | 160 | lang = xx }} the translated versions can be shown:
arabic: ivrit:
korean:
japan:
cyrill:
File Function Letters
This option is completely different from the description above, a value is returned instead of displaying something. By invoking the Module:File various functions can be performed. While parameter #1 specifies the file, the File Function Letter must be specified with parameter #2 or #3. Such a FFL has precedence, additional parameter settings are ignored.
Except of the mere string operations F and X, for files outside the commons none of the File Functions can be performed.
| FFL | function | returned result |
|---|---|---|
| C | count | number of file pages |
| D | date | work date, formatted |
| F | file name | name without extension |
| X | extension | extension without name |
| I | ifexist | "true" if file exists |
| S | size | file size in bytes |
| H | height | height in pixel |
| W | width | width in pixel |
| V | valid? | error count from W3C validation |
| P | page size | size of file description page in bytes |
Example: file name: Buddhist flag (SVG file, nominally 450 × 300 pixels, file size: 344 bytes.)
== Notes ==
- ↑ 1.0 1.1 1.2 1.3 1.4 1.5 Parameter #1 can only hold the filename; an alternate text can only be passed with parameter #2, and the display-size only with parameter #3. Other codes are not fixed.
Any of the codes (b, l, n, Z) can be passed in any sequence, each as an argument for one of the parameters either #2, #4, #5, #6 or #7: {{F|X.jpg||16|b|l|n}} is equivalent to {{F|X.jpg|n|16|l|b}}.
"b", "l" or "n" may even be coded at the position of parameter #3 when no pixel size is specified there, or of parameter #2 when no text is passed.
When it is required to display a text of one character equal to "b", "l", "n" or "Z" or a FFL it can be distinguished from such a code by an expansion, e.g. with <nowiki/>. - ↑ 2.0 2.1 2.2 The size may be e.g.
96or60x16. It is not possible to display images of other Wikipedias - only when the files are stored in the Commons. - ↑ A File Function Letter can be passed only with parameter either #2 or #3.