Template:G/doc: Difference between revisions
More actions
m Fix Linter errors. |
+de |
||
| Line 4: | Line 4: | ||
|1 =1 | |1 =1 | ||
|1d =(list of) file(s) to be displayed, can be in different [[#File list notations|⇒ notations]] | |1d =(list of) file(s) to be displayed, can be in different [[#File list notations|⇒ notations]] | ||
|1d-td =(list of) file(s) to be displayed, can be in different ⇒ notations | |||
|1d-de =(Liste der) Datei(en), die angezeigt werden sollen, kann in verschiedenen [[#File list notations|⇒ Notationen]] vorliegen | |||
|1d-td-de=(Liste der) Datei(en), die angezeigt werden sollen, kann in verschiedenen ⇒ Notationen vorliegen | |||
|1def = | |1def = | ||
|1stat =suggested | |1stat =suggested | ||
| Line 10: | Line 13: | ||
|2d =one of the six numbers to specify the [[#The parameter "format"|⇒ format]]: <code>0</code> to <code>5</code><br /> | |2d =one of the six numbers to specify the [[#The parameter "format"|⇒ format]]: <code>0</code> to <code>5</code><br /> | ||
whether or how the displayed image(s) should be captioned | whether or how the displayed image(s) should be captioned | ||
|2d-td =one of the six numbers to specify the ⇒ format: 0 to 5, whether or how the displayed image(s) should be captioned | |||
|2d-de =eine der sechs Zahlen, um das [[#Der Parameter „format“|⇒ Format]] festzulegen: <code>0</code> bis <code>5</code><br /> | |||
ob und wie die angezeigten Bilder mit Bildunterschriften versehen werden sollen | |||
|2d-td-de =eine der sechs Zahlen, um das ⇒ Format festzulegen: 0 bis 5, ob und wie die angezeigten Bilder mit Bildunterschriften versehen werden sollen | |||
|2aliases=format | |2aliases=format | ||
|2def =1 | |2def =1 or 2 | ||
|2stat =optional- | |2stat =optional- | ||
|3 =m | |3 =m | ||
|3d =gallery mode, can be specified with <br /> | |3d =gallery mode, can be specified with <br /><syntaxhighlight inline lang=wikitext>t</syntaxhighlight> or <syntaxhighlight inline lang=wikitext>traditional</syntaxhighlight><br /><syntaxhighlight inline lang=wikitext>n</syntaxhighlight> or <syntaxhighlight inline lang=wikitext>nolines</syntaxhighlight>, <br /><syntaxhighlight inline lang=wikitext>p</syntaxhighlight> or <syntaxhighlight inline lang=wikitext>packed</syntaxhighlight>,<br /><syntaxhighlight inline lang=wikitext>h</syntaxhighlight> or <syntaxhighlight inline lang=wikitext>packed-hover</syntaxhighlight>, <br /><syntaxhighlight inline lang=wikitext>o</syntaxhighlight> or <syntaxhighlight inline lang=wikitext>packed-overlay</syntaxhighlight>, <br /><syntaxhighlight inline lang=wikitext>s</syntaxhighlight> or <syntaxhighlight inline lang=wikitext>slideshow</syntaxhighlight> <br />when parameter <syntaxhighlight inline lang=wikitext>format</syntaxhighlight> is not specified, <syntaxhighlight inline lang=wikitext>nolines</syntaxhighlight> is defaulted, but that defaulting can be avoided with an empty mode parameter <syntaxhighlight inline lang=wikitext>m=</syntaxhighlight> | ||
|3d-td =gallery mode, can be specified with t or traditional, "n" or "nolines", "p" or "packed", "h" or "packed-hover", "o" or "packed-overlay", "s" or "slideshow", when parameter "format" is not specified, "nolines" is defaulted, but that defaulting can be avoided with an empty mode parameter "m=" | |||
|3d-de =Galeriemodus, kann angegeben werden mit: <br /><syntaxhighlight inline lang=wikitext>t</syntaxhighlight> oder <syntaxhighlight inline lang=wikitext>traditional</syntaxhighlight><br /><syntaxhighlight inline lang=wikitext>n</syntaxhighlight> oder <syntaxhighlight inline lang=wikitext>nolines</syntaxhighlight>, <br /><syntaxhighlight inline lang=wikitext>p</syntaxhighlight> oder <syntaxhighlight inline lang=wikitext>packed</syntaxhighlight>,<br /><syntaxhighlight inline lang=wikitext>h</syntaxhighlight> oder <syntaxhighlight inline lang=wikitext>packed-hover</syntaxhighlight>, <br /><syntaxhighlight inline lang=wikitext>o</syntaxhighlight> oder <syntaxhighlight inline lang=wikitext>packed-overlay</syntaxhighlight>, <br /><syntaxhighlight inline lang=wikitext>s</syntaxhighlight> oder <syntaxhighlight inline lang=wikitext>slideshow</syntaxhighlight><br />Wenn der Parameter <syntaxhighlight inline lang=wikitext>format</syntaxhighlight> nicht angegeben ist, wird <syntaxhighlight inline lang=wikitext>nolines</syntaxhighlight> als Standard verwendet, was aber mit einem leeren Modusparameter <syntaxhighlight inline lang=wikitext>m=</syntaxhighlight> vermieden werden kann. | |||
|3d-td-de =Galeriemodus, kann mit „t“ oder „traditional“, „n“ oder „nolines“, „p“ oder „packed“, „h“ oder „packed-hover“, „o“ oder „packed-overlay“, „s“ oder „slideshow“ angegeben werden, wenn der Parameter „format“ nicht angegeben ist. wird „nolines“ als Standard verwendet, aber das kann man umgehen, indem man den Modusparameter „m=“ leer lässt. | |||
|3aliases=mode | |3aliases=mode | ||
|3def = | |3def = | ||
|3stat =optional- | |3stat =optional- | ||
|4 =c | |4 =c | ||
|4d =gallery caption <small>(may be shifted to the left with e.g. some trailing <code>&emsp;</code> entities)</small> | |4d =gallery caption <small>(may be shifted to the left with e.g. some trailing <code>&emsp;</code> entities)</small> | ||
|4d-td =gallery caption (may be shifted to the left with e.g. some trailing   entities | |||
|4d-de =Galeriebeschriftung <small>(kann z. B. mit einigen nachgestellten <code>&emsp;</code>-Entitäten nach links verschoben werden)</small> | |||
|4d-td-de=Galeriebeschriftung (kann z. B. mit einigen nachgestellten  -Zeichen nach links verschoben werden) | |||
|4aliases=caption | |4aliases=caption | ||
|4stat =optional- | |4stat =optional- | ||
| Line 27: | Line 40: | ||
|5 =p | |5 =p | ||
|5d =pictures {{T\|per row}} | |5d =pictures {{T\|per row}} | ||
|5d-td =pictures per row | |||
|5d-de =Bilder {{T\|pro Zeile}} | |||
|5d-td-de=Bilder pro Zeile | |||
|5aliases=perrow | |5aliases=perrow | ||
|5stat =optional- | |5stat =optional- | ||
| Line 32: | Line 48: | ||
|6 =s | |6 =s | ||
|6d =style attributes, e.g. <code>s=float:right</code> | |6d =style attributes, e.g. <code>s=float:right</code> | ||
|6d-td =style attributes, e.g. "s=float:right" | |||
|6d-de =Style-Attribute, z. B. <code>s=float:right</code> | |||
|6d-td-de=Style-Attribute, z. B. „s=float:right“ | |||
|6aliases=style | |6aliases=style | ||
|6stat =optional- | |6stat =optional- | ||
| Line 37: | Line 56: | ||
|7 =a | |7 =a | ||
|7d =class attributes: any wikimedia class; <br />or the special code "c" (<code>a=c</code>) for a global <code><nowiki><center></nowiki></code> tag | |7d =class attributes: any wikimedia class; <br />or the special code "c" (<code>a=c</code>) for a global <code><nowiki><center></nowiki></code> tag | ||
|7d-td =class attributes: any wikimedia class; or the special code "c" ("a=c") for a global <center> tag | |||
|7d-de =Class-Attribute: jede Wikimedia-Klasse; <br />oder der spezielle Code „c“ (<code>a=c</code>) für ein globales <code><nowiki><center></nowiki></code>-Tag | |||
|7d-td-de=Class-Attribute: Jede Wikimedia-Klasse oder der spezielle Code „c“ („a=c“) für einen globalen <center>-Tag. | |||
|7aliases=attr, class | |7aliases=attr, class | ||
|7stat =optional- | |7stat =optional- | ||
| Line 42: | Line 64: | ||
|8 =w | |8 =w | ||
|8d =width for the displays | |8d =width for the displays | ||
|8d-td =width for the displays | |||
|8d-de =Breite für die Displays | |||
|8d-de-td=Breite für die Displays | |||
|8aliases=widths | |8aliases=widths | ||
|8stat =optional- | |8stat =optional- | ||
| Line 47: | Line 72: | ||
|9 =h | |9 =h | ||
|9d =height for the displays | |9d =height for the displays | ||
|9d-td =height for the displays | |||
|9d-de =Höhe für die Displays | |||
|9d-td-de=Höhe für die Displays | |||
|9aliases=heights | |9aliases=heights | ||
|9stat =optional- | |9stat =optional- | ||
| Line 52: | Line 80: | ||
|10 =d | |10 =d | ||
|10d =display size; can specify <code>widths</code> ''and'' <code>heights</code> | |10d =display size; can specify <code>widths</code> ''and'' <code>heights</code> | ||
|10d-td =display size; can specify "widths" and "heights" | |||
|10d-de =Anzeigegröße; kann <code>Breiten</code> '''und''' <code>Höhen</code> angeben | |||
|10d-td-de=Anzeigegröße; kann Breiten und Höhen angeben | |||
|10aliases=display | |10aliases=display | ||
|10stat =optional- | |10stat =optional- | ||
| Line 57: | Line 88: | ||
|11 =t | |11 =t | ||
|11d =text size; can specify a tag like e.g. "small" or "big" | |11d =text size; can specify a tag like e.g. "small" or "big" | ||
|11d-de =Textgröße; du kannst ein Tag wie z. B. “small“ oder “big“ angeben. | |||
|11aliases=text | |11aliases=text | ||
|11stat =optional- | |11stat =optional- | ||
| Line 62: | Line 94: | ||
|12 =n | |12 =n | ||
|12d =when invoked from a file: don't display the image itself | |12d =when invoked from a file: don't display the image itself | ||
|12d-td =when invoked from a file: don't display the image itself | |||
|12d-de =wenn von einer Datei-Seite aufgerufen: Zeig das eigentliche Bild nicht an. | |||
|12d-de-t=wenn von einer Datei-Seite aufgerufen: Zeig das eigentliche Bild nicht an. | |||
|12aliases=notself | |12aliases=notself | ||
|12stat =optional- | |12stat =optional- | ||
|name={{BASEPAGENAME}} | |name={{BASEPAGENAME}} | ||
|desc | |desc=Displays a gallery of files, using just the conventional <syntaxhighlight inline lang=wikitext><gallery></syntaxhighlight> tag, but with shorter parametrizing and some useful defaults. | ||
|desc-td=Displays a gallery of files, using just the conventional "gallery" tag, but with shorter parametrizing and some useful defaults. | |||
|desc-de=Zeigt eine Galerie von Dateien an, indem einfach das übliche Tag <syntaxhighlight inline lang=wikitext><gallery></syntaxhighlight> benutzt wird, aber mit kürzeren Parametern und ein paar nützlichen Standardeinstellungen. | |||
|desc-td-de=Zeigt eine Galerie von Dateien an, indem einfach das übliche Tag "gallery" benutzt wird, aber mit kürzeren Parametern und ein paar nützlichen Standardeinstellungen. | |||
|namespace=all | |||
|namespace= | |||
|usergroup=all | |usergroup=all | ||
|usage-notes= | |usage-notes={{LangSwitch | ||
|type= | |en = Such a gallery can contain one file or more, up to an unlimited number: | ||
* with just {{Tle|T=G|filename}} a 'gallery' of a single file can be shown, | |||
* with e.g. {{Tle|T=G|filename1|filename2| ... }} more files are displayed. | |||
The display format can be influenced by several additional options. | |||
|de = So eine Galerie kann eine Datei oder mehrere enthalten, die Anzahl ist nicht begrenzt: | |||
* mit lediglich {{Tle|T=G|Dateiname}} kann eine „Galerie” mit einer einzigen Datei angezeigt werden, | |||
* mit z. B. {{Tle|T=G|Dateiname1|Dateiname2| ... }} werden mehrere Dateien angezeigt. | |||
Das Anzeigeformat kann durch mehrere zusätzliche Optionen beeinflusst werden. | |||
}} | |||
|type=formatting | |||
|example= | |example= | ||
|i18n-method=- | |i18n-method=- | ||
|i18n-desc= | |i18n-desc= | ||
|seealso= | |seealso= | ||
* {{T|F}} has a reduced [[Template:F#Gallery_style|Gallery Function]] | |||
* {{T|Gallery}} | |||
For easy switching between both modules, their shortcode character parameters [[Module talk:Galeria/doc|won't conflict]]. | * {{T|Gallery items}} | ||
* {{W|Help:Images#Rendering a gallery of_images||mw}} (on mediawiki.org) | |||
* some {{C|Lua-based iteration templates}} have an option to invoke the gallery function; they invoke either {{M|Iteration}} or {{M|Galeria}}. For easy switching between both modules, their shortcode character parameters [[Module talk:Galeria/doc|won't conflict]]. | |||
* {{ | ** {{T|Derivative versions}} | ||
* {{ | ** {{T|Other versions}} | ||
* {{ | ** {{T|Filelist}} | ||
** {{T|File}} | |||
* for the language gallery of a '''multi-language file''', use one of | |||
** {{T|Lang gallery}} | |||
** {{T|Lgallery}} | |||
** {{T|Svg lang}} | |||
|setscats= | |setscats= | ||
|lines= | |lines= | ||
|shorthand= | |shorthand= | ||
|relieson= | |relieson={{Lua|Module:Galeria}} | ||
|useTemplateData=yes | |||
}} | }} | ||
Revision as of 15:59, 20 November 2025
Displays a gallery of files, using just the conventional <gallery> tag, but with shorter parametrizing and some useful defaults.
Usage
{{G |1= }}
Such a gallery can contain one file or more, up to an unlimited number:
- with just {{ G | filename }} a 'gallery' of a single file can be shown,
- with e.g. {{ G | filename1 | filename2 | ... }} more files are displayed.
The display format can be influenced by several additional options.
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
1 | (list of) file(s) to be displayed, can be in different ⇒ notations | empty | suggested | |
fformat | one of the six numbers to specify the ⇒ format: 0 to 5whether or how the displayed image(s) should be captioned | 1 or 2 | optional | |
mmode | gallery mode, can be specified with t or traditionaln or nolines, p or packed,h or packed-hover, o or packed-overlay, s or slideshow when parameter format is not specified, nolines is defaulted, but that defaulting can be avoided with an empty mode parameter m= | empty | optional | |
ccaption | gallery caption (may be shifted to the left with e.g. some trailing   entities) | empty | optional | |
pperrow | pictures per row | empty | optional | |
sstyle | style attributes, e.g. s=float:right | empty | optional | |
aattr, class | class attributes: any wikimedia class; or the special code "c" ( a=c) for a global <center> tag | empty | optional | |
wwidths | width for the displays | empty | optional | |
hheights | height for the displays | empty | optional | |
ddisplay | display size; can specify widths and heights | empty | optional | |
nnotself | when invoked from a file: don't display the image itself | empty | optional | |
|
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard. Existing template documentation Newly created template documentation and imports Wikipedia's help about TemplateData • Commons-specific information Displays a gallery of files, using just the conventional "gallery" tag, but with shorter parametrizing and some useful defaults.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Additional information
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
Relies on:
See also
- {{F}} has a reduced Gallery Function
- {{Gallery}}
- {{Gallery items}}
- Help:Images#Rendering a gallery of_images (on mediawiki.org)
- some Lua-based iteration templates have an option to invoke the gallery function; they invoke either Iteration or Galeria. For easy switching between both modules, their shortcode character parameters won't conflict.
- for the language gallery of a multi-language file, use one of
Localization
This template is not intended to be localized.
The parameter "w", "d", "h"
The display size can be specified with either widths and/or heights, or with display.
While "w" and "h" can specify the number of the pixels, "d" consists of three optional parts: [w] [xh] [px].
"w" and/or "h" have precedence: "d" is only checked when neither "w" nor "h" are specified.
The parameter "format"
can specify one of the following numbers how naming captions for the single files are displayed:
- no naming; same as specifying an empty
f=, or another value - naming with the "showfilename" option
- naming with the second value of parameter pairs (default is the first value, linked)
- same as format=2 but the defaults are displayed without link
- same as format=2 (default is the first value, linked, but without the extension)
- same as format=4 but the name is not linked
When format and width and mode are missing, mode becomes defaulted with nolines.
Defaulting the "format"
This parameter is a necessary addition to the parameters used by <gallery>.
When the most frequent invocation form for <gallery> is used, i.e.
- the first parameter is preceded by a linefeed,
- and the second parameter exists,
- and it is separated from the first one by a pipe,
- and it does not also end with a
.and file extension
- and it does not also end with a
then no format must be specified, "f=2" is assumed, and
the display with {{G| ... }} is the almost same as with <gallery> ... </gallery>.
When not all these requirements are fulfilled, the parameter needs to be specified!
Otherwise a missing format parameter is defaulted with "f=1".
- but only the form as described above will result in the "format" defaulting.
File list notations
The list of the files ("items") for the gallery can be specified in the notation
- List 1
- {{ G | file1.ext | file2.ext | ... | filen.ext | more parameters }}
or as a list separated by mandatory linefeeds
- List 2
- {{ G |
file1.ext
file2.ext
...
filen.ext
| more parameters }}
Also a mixture of both notations is possible.
With 1=, 2=, 3= up to n= an unlimited number of items can be specified.
Each unnamed parameter (p1 to p∞) can contain an unlimited number of linefeed-separated items.
For format=2 parameter pairs of file + description must be specified:
- List 3
- {{ G | file1.ext | description1 | file2.ext | description2 | ... | filen.ext | descriptionn | f = 2 | more parameters }}
This format needs always parameter pairs, but the description may be without value (just a pipe or an empty new line).
When the description is empty, the name of the file is displayed instead; but a description as e.g. will be used!
format=2 care should be taken when defining the items; it does not matter whether they are pipe-separated or linefeed-separated, but file names are defined with item1, item3, item5, ...
while the descriptions are defined with the corresponding item2, item4, item6, ...
Description items can be specified empty, but file name items ought to contain a value.
A good idea for an easy way to read input will be (with the possibility not to need the 'format' parameter)
- {{ G |
file1.ext | name1
file2.ext | name2
...
| more parameters }}
Indentions
Indentions are not intended by the gallery tag, if any are required the aligne attribute of tables can be used, e.g.
{|
|style="padding-left:2em"|{{G|..... }}
|}
Examples
Shows different parametrizings, and item notations (separation with "pipes" and linefeeds).
| just one file without option parameters {{G| Example.png}} That image can as well be obtained with <gallery mode="nolines" showfilename="yes"> Example.png</gallery> | |
| some files, without option parameters {{G|Example ba.svg|Example de.svg|Example bn.svg|Example de.svg|Example en.svg|Example ru.svg|Example lt.svg|Example ro.svg|Example tr.svg}} | |
|
{{G|Day-template.svg
Emojione 1F642.svg
Emojione BW 1F642.svg
Laughing-smiley.svg
Noto Emoji Oreo 1f642.svg
Noto Emoji Pie 1f642.svg
Line-style-icons-happy.svg
Nuvola emoticon - happy.svg
|c=eight smileys    |f=0|w=48|m=n}}
|
globally centered with a=c{{G|Blue king.svg|Chess kgt45.svg
|Chess krt45.svg|Chess kyt45.svg
|Green king.svg|Red king.svg
|Yellow king.svg|Chess kdt45.svg
|f=0|w=80|p=4|a=c}}
| |
|
Some descriptions are missing {{G|
File:Pink check.svg|pink
Purple check.svg|purple
Olive green check.svg|{{W|olive}}
image:Yellow check.svg|yellow
Cornflower blue check.svg|blue
Black check.svg|
White check.svg|white
Green check.svg|green
File:Red_check.svg|
Orange check.svg|{{W|orange}}
Light green check.svg|green
|w=96}}the input is easy to read this way (and does not need the 'format' parameter) namespace ("file" or "image") won't disturb |
but not so easy to read that way:{{G|EU-section-with-A.svg|{{W|Austria}}|EU-section-with-BG.svg|{{W|Bulgaria}}|EU-section-with-CY.svg|{{W|Cyprus}}
|EU-section-with-CZ.svg|{{W|Czech}}|EU-section-with-D.svg|{{W|Germany}}|EU-section-with-DK.svg|{{W|Denmark}}
|EU-section-with-B.svg|{{W|Belgium}}|EU-section-with-EST.svg|{{W|Estonia}}|EU-section-with-FIN.svg|{{W|Finland}}
|EU-section-with-GR.svg|{{W|Greece}}|EU-section-with-IRL.svg|{{W|Irland}}|EU-section-with-SLO.svg|{{W|Slovenia}}|f=2|h=80|m=n}}
|
|
the description can also contain an URL{{G|
Structural-Iceberg-ca.svg|{{Plainlinks|http://lightningvolt.com/Image%20Gallery/imagegallery.htm|URL 1}}
Structural-Iceberg-cs.svg|{{W|{{#language:cs}}}}
Structural-Iceberg.svg|{{Plainlinks|1=https://npgallery.nps.gov/AssetDetail/NRIS/1111|2=NRHP}}
Structural-Iceberg-ja.svg|{{#language:ja}}
|w=48|m=n}}
|
See also
- {{Gallery}} and Module:Gallery