Template:G/doc: Difference between revisions
More actions
+de |
reworked |
||
| Line 66: | Line 66: | ||
|8d-td =width for the displays | |8d-td =width for the displays | ||
|8d-de =Breite für die Displays | |8d-de =Breite für die Displays | ||
|8d-de | |8d-td-de=Breite für die Displays | ||
|8aliases=widths | |8aliases=widths | ||
|8stat =optional- | |8stat =optional- | ||
| Line 96: | Line 96: | ||
|12d-td =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 =wenn von einer Datei-Seite aufgerufen: Zeig das eigentliche Bild nicht an. | ||
|12d-de | |12d-td-de=wenn von einer Datei-Seite aufgerufen: Zeig das eigentliche Bild nicht an. | ||
|12aliases=notself | |12aliases=notself | ||
|12stat =optional- | |12stat =optional- | ||
| Line 110: | Line 110: | ||
|en = Such a gallery can contain one file or more, up to an unlimited number: | |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 just {{Tle|T=G|filename}} a 'gallery' of a single file can be shown, | ||
* with e.g. {{Tle|T=G|filename1|filename2| | * with e.g. {{Tle|T=G|filename1|filename2| … }} more files are displayed. | ||
The display format can be influenced by several additional options. | The display format can be influenced by several additional options. | ||
== The parameter "w", "d", "h" == | ==== The parameter "w", "d", "h" ==== | ||
The display size can be specified with either <code>widths</code> and/or <code>heights</code>, or with <code>display</code>.<br /> | The display size can be specified with either <code>widths</code> and/or <code>heights</code>, or with <code>display</code>.<br /> | ||
While "w" and "h" can specify the number of the pixels, "d" consists of three optional parts: [w] [<code>x</code>h] [px].<br /> | While "w" and "h" can specify the number of the pixels, "d" consists of three optional parts: [w] [<code>x</code>h] [px].<br /> | ||
"w" and/or "h" have ''precedence'': "d" is only checked when neither "w" nor "h" are specified. | "w" and/or "h" have ''precedence'': "d" is only checked when neither "w" nor "h" are specified. | ||
== The parameter "format" == | ==== The parameter "format" ==== | ||
can specify one of the following numbers how naming captions for the single files are displayed: | can specify with one of the following numbers how naming captions for the single files are displayed: | ||
#<li value="0"> no naming; same as specifying an empty '''<code>f=</code>''' , or another value | #<li value="0"> no naming; same as specifying an empty '''<code>f=</code>''' , or another value | ||
# naming with the "showfilename" option <!-- (<code>f=1</code> is also the default) --> | # naming with the "showfilename" option <!-- (<code>f=1</code> is also the default) --> | ||
| Line 155: | Line 126: | ||
# same as format=2 (default is the first value, linked, but ''without'' the extension) | # same as format=2 (default is the first value, linked, but ''without'' the extension) | ||
# same as format=4 but the name is not linked | # same as format=4 but the name is not linked | ||
{{Notice|1= While options like <code>showfilename</code> or <code>mode=slideshow</code> are deprecated in namespaces as e.g. articles or galleries, they can be very useful in e.g. file descriptions, or talk pages.</div> | |||
When format ''and'' width ''and'' mode are missing, <code>mode</code> becomes defaulted with <code>nolines</code>. | When <code>format</code> ''and'' <code>width</code> ''and'' <code>mode</code> are missing, <code>mode</code> becomes defaulted with <code>nolines</code>.}} | ||
=== Defaulting the "format" === | ===== Defaulting the "format" ===== | ||
The parameter <code>format</code> is a necessary addition to the parameters used by <syntaxhighlight inline lang=wikitext><gallery></syntaxhighlight>.<br /> | |||
When the most frequent invocation form for < | When the most frequent invocation form for <syntaxhighlight inline lang=wikitext><gallery></syntaxhighlight> is used, i.e. | ||
* the first parameter is preceded by a linefeed, | * the first parameter is preceded by a linefeed, | ||
:* ''and'' the second parameter exists, | :* ''and'' the second parameter exists, | ||
| Line 166: | Line 137: | ||
:::* ''and'' it does ''not also'' end with a <code>.</code> and file extension | :::* ''and'' it does ''not also'' end with a <code>.</code> and file extension | ||
then ''no format must be specified'', "'''<code>f=2</code>'''" is assumed, and<br /> | then ''no format must be specified'', "'''<code>f=2</code>'''" is assumed, and<br /> | ||
the display with < | the display with <syntaxhighlight inline lang=wikitext>{{G| … }}</syntaxhighlight> is the almost same as with <syntaxhighlight inline lang=wikitext><gallery> … </gallery></syntaxhighlight>.<br /> | ||
When not all these requirements are fulfilled, the parameter needs to be specified!<br /> | When not all these requirements are fulfilled, the parameter needs to be specified!<br /> | ||
Otherwise a missing format parameter is defaulted with "'''<code>f=1</code>'''". | Otherwise a missing format parameter is defaulted with "'''<code>f=1</code>'''". | ||
{{Notice|1=There are other valid possibilities to specify the parameters; | |||
::::but ''only the form as described above'' will result in the | ::::but ''only the form as described above'' will result in the <code>format</code> defaulting.}} | ||
== File list notations == | ==== File list notations ==== | ||
The list of the files ("items") for the gallery can be specified in the notation | The list of the files ("items") for the gallery can be specified in the notation | ||
;List 1: {{tle|T=G|file1.ext|file2.ext| | ;List 1: {{tle|T=G|file1.ext|file2.ext|…|file{{sub|n}}.ext|more parameters}} | ||
or as a list separated by <u>mandatory linefeeds</u> | or as a list separated by <u>mandatory linefeeds</u> | ||
;List 2: {{tle|T=G|<br />file1.ext<br />file2.ext<br /> | ;List 2: {{tle|T=G|<br />file1.ext<br />file2.ext<br />…<br />file{{sub|n}}.ext<br />|more parameters}} | ||
Also a mixture of both notations is possible. | Also a mixture of both notations is possible. | ||
{{Notice|1=The file names ("items") are specified with unnamed parameters.<br /> | |||
With <code>1=</code>, <code>2=</code>, <code>3=</code> up to <code>n=</code> an '''unlimited number''' of items can be specified.<br /> | With <code>1=</code>, <code>2=</code>, <code>3=</code> up to <code>n=</code> an '''unlimited number''' of items can be specified.<br /> | ||
Each unnamed parameter (p{{sub|1}} to p{{sub|∞}}) can contain an '''unlimited number''' of linefeed-separated items. | Each unnamed parameter (p{{sub|1}} to p{{sub|∞}}) can contain an '''unlimited number''' of linefeed-separated items. {{See also |Template talk:G#Item separation|overview}} }} | ||
For <code>format=2</code> ''parameter pairs'' of file + description must be specified: | For <code>format=2</code> ''parameter pairs'' of file + description must be specified: | ||
;List 3: {{tle|T=G|file1.ext|description1|file2.ext|description2| | ;List 3: {{tle|T=G|file1.ext|description1|file2.ext|description2|…|file{{sub|n}}.ext|description{{sub|n}}|p8= 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).<br /> | This format needs always parameter pairs, but the description may be without value (just a pipe or an empty new line).<br /> | ||
When the description is empty, the name of the file is displayed instead; but a description as e.g. <code>&nbsp;</code> will be used! | When the description is empty, the name of the file is displayed instead; but a description as e.g. <code>&nbsp;</code> will be used! | ||
{{Notice |1=For <code>format=2</code> care should be taken when defining the items; it does not matter <br />whether they are pipe-separated or linefeed-separated, but ''file names'' are defined with item{{sub|1}}, item{{sub|3}}, item{{sub|5}},… <br />while the descriptions are defined with the corresponding item{{sub|2}}, item{{sub|4}}, item{{sub|6}},…<br /> | |||
Description items can be specified empty, but file name items ought to contain a value. | 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) | A good idea for an easy way to read input will be (with the possibility not to need the 'format' parameter) | ||
:{{tle|T=G|<br />file1.ext | name1<br />file2.ext | name2<br /> | :{{tle|T=G|<br />file1.ext | name1<br />file2.ext | name2<br />…<br />| more parameters}} | ||
== Indentions == | == Indentions == | ||
Indentions are not intended by the gallery tag, if any are required the | Indentions are not intended by the <syntaxhighlight inline lang=wikitext><gallery></syntaxhighlight> tag, if any are required the <code>align</code> attribute of tables can be used, e.g. <syntaxhighlight copy line lang=wikitext> | ||
{| | {| | ||
|style="padding-left:2em"|{{G|..... }} | |style="padding-left:2em"|{{G| … }} | ||
|}</ | |}</syntaxhighlight> | ||
|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. | |||
==== Die Parameter „w“, „d“, „h“ ==== | |||
Die Displaygröße kann entweder mit <code>widths</code> und/oder <code>heights</code> oder mit <code>display</code> angegeben werden. | |||
Während „w” und „h” die Anzahl der Pixel angeben können, besteht „d” aus drei optionalen Teilen: [w] [<code>x</code>h] [px].<br /> | |||
„w” und/oder „h” haben Vorrang: „d” wird nur überprüft, wenn weder „w” noch „h” angegeben sind. | |||
==== Der Parameter „format“ ==== | |||
kann mit einer der folgenden Zahlen festlegen, wie die Benennung der einzelnen Dateien angezeigt wird: | |||
#<li value="0"> keine Benennung; wie die Angabe eines leeren '''<code>f=</code>''' oder eines anderen Werts | |||
# Benennung mit der Option „showfilename“ <!-- (<code>f=1</code> ist auch die Standardeinstellung) --> | |||
# Benennung mit dem zweiten Wert der Parameterpaare (Standard ist der erste Wert, verlinkt) | |||
# wie format=2, aber die Standardeinstellungen werden ohne Link angezeigt | |||
# wie format=2 (Standard ist der erste Wert, verlinkt, aber ''ohne'' die Erweiterung) | |||
# wie format=4, aber der Name ist nicht verlinkt | |||
{{Notice|1=Obwohl Optionen wie <code>showfilename</code> oder <code>mode=slideshow</code> in Namensräumen wie z. B. Artikeln oder Galerien nicht mehr verwendet werden sollten, können sie in Dateibeschreibungen oder Diskussionsseiten echt nützlich sein. | |||
Wenn <code>format</code> ''und'' <code>width</code> ''und'' <code>mode</code> fehlen, wird <code>mode</code> standardmäßig auf <code>nolines</code> gesetzt.}} | |||
===== Standardwert für „Format“ ===== | |||
Der Parameter <code>format</code> ist eine wichtige Ergänzung zu den Parametern, die von <syntaxhighlight inline lang=wikitext><gallery></syntaxhighlight> benutzt werden.<br /> | |||
Wenn die häufigste Aufrufform für <syntaxhighlight inline lang=wikitext><gallery></syntaxhighlight> benutzt wird, also | |||
* dem ersten Parameter ein Zeilenumbruch vorangestellt ist, | |||
:* ''und'' der zweite Parameter vorhanden ist, | |||
::* ''und'' er durch ein Pipe-Zeichen vom ersten getrennt ist, | |||
:::* ''und'' er ''nicht auch'' mit einem <code>.</code> und einer Dateiendung endet | |||
dann ''darf kein Format angegeben werden'', es wird „'''<syntaxhighlight inline lang=wikitext>f=2</syntaxhighlight>'''” angenommen und | |||
die Anzeige mit <syntaxhighlight inline lang=wikitext>{{G| ... }}</syntaxhighlight> ist fast die gleiche wie mit <syntaxhighlight inline lang=wikitext><gallery> ... </gallery></syntaxhighlight>.<br /> | |||
Wenn nicht alle diese Anforderungen erfüllt sind, dann muss der Parameter angegeben werden!<br /> | |||
Sonst wird ein fehlender Formatparameter standardmäßig mit „'''<code>f=1</code>'''” ersetzt. | |||
{{Notice|1=Es gibt noch andere Möglichkeiten, die Parameter festzulegen, aber ''nur die oben beschriebene Form'' führt dazu, dass das <code>format</code> standardmäßig verwendet wird.}} | |||
==== Notationen der Dateiliste ==== | |||
Die Liste der Dateien (“items“) für die Galerie kann in der Notation | |||
;Liste 1: {{tle|T=G|Datei1.ext|Datei2.ext|…|Datei{{sub|n}}.ext|weitere Parameter}} | |||
oder als Liste durch ''obligatorische Zeilenumbrüche'' getrennt angegeben werden | |||
;Liste 2: {{tle|T=G|<br />file1.ext<br />file2.ext<br />…<br />file{{sub|n}}.ext<br />|weitere Parameter}} | |||
Auch eine Mischung aus beiden Notationen ist möglich. | |||
{{Notice|1=Die Dateinamen (“items“) werden mit unbenannten Parametern angegeben.<br /> | |||
Mit <code>1=</code>, <code>2=</code>, <code>3=</code> bis zu <code>n=</code> kann man eine '''unbegrenzte Anzahl''' von „items“ angeben.<br /> | |||
Jeder unbenannte Parameter (p{{sub|1}} bis p{{sub|∞}}) kann eine '''unbegrenzte Anzahl''' von durch Zeilenumbrüche getrennten Elementen enthalten. {{See also|Template talk:G#Item separation|Übersicht}}}} | |||
Für <code>format=2</code> musst du ''Parameterpaare'' aus Datei + Beschreibung angeben: | |||
;Liste 3: {{tle|T=G|datei1.ext|beschreibung1|datei2.ext|beschreibung2|…|datei{{sub|n}}.ext|beschreibung{{sub|n}}|p8= f|2|weitere Parameter}} | |||
Dieses Format braucht immer Parameterpaare, aber die Beschreibung kann ohne Wert sein (nur ein Pipe-Zeichen oder eine leere Zeile). | |||
Wenn die Beschreibung leer ist, wird stattdessen der Name der Datei angezeigt; aber eine Beschreibung wie z. B. <code>&nbsp;</code> wird verwendet! | |||
{{Notice|1=Bei <code>format=2</code> muss man bei der Definition der Elemente vorsichtig sein; es ist egal, ob sie durch Pipe-Zeichen oder Zeilenumbrüche getrennt sind, aber „Dateinamen” werden mit item{{sub|1}}, item{{sub|3}}, item{{sub|5}},… definiert, während die Beschreibungen mit den entsprechenden item{{sub|2}}, item{{sub|4}}, item{{sub|6}},… definiert werden. Beschreibungselemente können leer angegeben werden, aber Dateinamenelemente sollten einen Wert enthalten.}} | |||
Eine einfache Möglichkeit zum Lesen der Eingabe wäre (mit der Option, den Parameter „format” wegzulassen) | |||
:{{tle|T=G|<br />datei1.ext | name1<br />datei2.ext | name2<br />...<br />| weitere Parameter}} | |||
==== Einrückungen ==== | |||
Einrückungen sind mit dem Tag <syntaxhighlight inline lang=wikitext><gallery></syntaxhighlight> nicht vorgesehen. Wenn du welche brauchst, kannst du das Attribut <code>align</code> von Tabellen verwenden, z. B. <syntaxhighlight copy line lang=wikitext> | |||
{| | |||
|style="padding-left:2em"|{{G| … }} | |||
|}</syntaxhighlight> | |||
}} | |||
|type=formatting | |||
|example= | |||
|i18n-method=- | |||
|i18n-desc= | |||
|seealso= | |||
* {{T|F}} has a reduced [[Template:F#Gallery_style|Gallery Function]] | |||
* {{T|Gallery}} | |||
* [[Module:Gallery]] | |||
* {{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= | |||
|lines= | |||
|shorthand= | |||
|relieson={{Lua|Module:Galeria}} | |||
|useTemplateData=yes | |||
}} | |||
== Examples == | == Examples == | ||
See here for different parameterisations and item notations, separated with pipes (|) and linefeeds (¶). | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- style="vertical-align:top;" | ||
|{{G| | |||
Example.png}} || | Example.png}} || Just one file without option parameters <syntaxhighlight copy line lang=wikitext>{{G| | ||
Example.png}}</ | Example.png | ||
|- | }}</syntaxhighlight> That image can as well be obtained with <syntaxhighlight copy line lang=wikitext><gallery mode="nolines" showfilename="yes">Example.png</gallery></syntaxhighlight> | ||
|- style="vertical-align:top;" | |||
|{{G|Example ba.svg| | |{{G|Example ba.svg| | ||
Example bn.svg|Example de.svg|Example en.svg|Example ru.svg|Example lt.svg|Example ro.svg|Example tr.svg}} | Example bn.svg|Example de.svg|Example en.svg|Example ru.svg|Example lt.svg|Example ro.svg|Example tr.svg}} | ||
| | |Some files, without option parameters <syntaxhighlight copy line lang=wikitext>{{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}}</syntaxhighlight> | ||
|- | |- style="vertical-align:top;" | ||
|{{G|Day-template.svg | |{{G|Day-template.svg | ||
Emojione 1F642.svg | Emojione 1F642.svg | ||
| Line 219: | Line 279: | ||
Line-style-icons-happy.svg | Line-style-icons-happy.svg | ||
Nuvola emoticon - happy.svg | Nuvola emoticon - happy.svg | ||
|f=0|w=48|m=n|c=eight smileys                        }} || < | |f=0|w=48|m=n|c=eight smileys                        }} || <syntaxhighlight copy line lang=wikitext>{{G|Day-template.svg | ||
Emojione 1F642.svg | Emojione 1F642.svg | ||
Emojione BW 1F642.svg | Emojione BW 1F642.svg | ||
| Line 227: | Line 287: | ||
Line-style-icons-happy.svg | Line-style-icons-happy.svg | ||
Nuvola emoticon - happy.svg | Nuvola emoticon - happy.svg | ||
|c=eight smileys & | |f=0|w=48|m=n|c=eight smileys                        }}</syntaxhighlight> | ||
|- | |- style="vertical-align:top;" | ||
| style="background:#CCC" | {{G|Blue king.svg|Chess kgt45.svg | | style="background:#CCC" | {{G|Blue king.svg|Chess kgt45.svg | ||
|Chess krt45.svg|Chess kyt45.svg | |Chess krt45.svg|Chess kyt45.svg | ||
|Green king.svg|Red king.svg | |Green king.svg|Red king.svg | ||
|Yellow king.svg|Chess kdt45.svg | |Yellow king.svg|Chess kdt45.svg | ||
|f=0|w=80|p=4|a=c}} || | |f=0|w=80|p=4|a=c}} || globally centered with <code>a=c</code> <syntaxhighlight copy line lang=wikitext>{{G|Blue king.svg|Chess kgt45.svg | ||
{{G|Blue king.svg|Chess kgt45.svg | |||
|Chess krt45.svg|Chess kyt45.svg | |Chess krt45.svg|Chess kyt45.svg | ||
|Green king.svg|Red king.svg | |Green king.svg|Red king.svg | ||
|Yellow king.svg|Chess kdt45.svg | |Yellow king.svg|Chess kdt45.svg | ||
|f=0|w=80|p=4|a=c}}</ | |f=0|w=80|p=4|a=c}}</syntaxhighlight> | ||
|- | |- style="vertical-align:top;" | ||
|{{G| | |{{G| | ||
File:Pink check.svg|pink | File:Pink check.svg|pink | ||
| Line 253: | Line 312: | ||
Light green check.svg|green | Light green check.svg|green | ||
|w=96}} | |w=96}} | ||
| | | Some descriptions are missing. The input is easy to read this way and does not need the 'format' parameter. Namespace ("file" or "image") won't disturb. <syntaxhighlight copy line lang=wikitext> | ||
{{G| | {{G| | ||
File:Pink check.svg|pink | File:Pink check.svg|pink | ||
| Line 266: | Line 325: | ||
Orange check.svg|{{W|orange}} | Orange check.svg|{{W|orange}} | ||
Light green check.svg|green | Light green check.svg|green | ||
|w=96}}</ | |w=96}}</syntaxhighlight> | ||
|- | |- style="vertical-align:top;" | ||
|{{G|EU-section-with-A.svg|{{W|Austria}}|EU-section-with-BG.svg|{{W|Bulgaria}}|EU-section-with-CY.svg|{{W|Cyprus}} | |{{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-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-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}} | |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}} | ||
| | | Not so easy to read that way: <syntaxhighlight copy line lang=wikitext>{{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-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-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}}</ | |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}}</syntaxhighlight> | ||
|- style="vertical-align:top;" | |||
|{{G| | |||
|- | |||
Structural-Iceberg-ca.svg|{{Plainlinks|http://lightningvolt.com/Image%20Gallery/imagegallery.htm|URL 1}} | Structural-Iceberg-ca.svg|{{Plainlinks|http://lightningvolt.com/Image%20Gallery/imagegallery.htm|URL 1}} | ||
Structural-Iceberg-cs.svg|{{W|{{#language:cs}}}} | Structural-Iceberg-cs.svg|{{W|{{#language:cs}}}} | ||
Structural-Iceberg.svg|{{Plainlinks|1=https://npgallery.nps.gov/AssetDetail/NRIS/1111|2=NRHP}} | Structural-Iceberg.svg|{{Plainlinks|1=https://npgallery.nps.gov/AssetDetail/NRIS/1111|2=NRHP}} | ||
Structural-Iceberg-ja.svg|{{#language:ja}} | Structural-Iceberg-ja.svg|{{#language:ja}} | ||
|w=48|m=n}} | |w=48|m=n}} || The description can also contain an URL. <syntaxhighlight copy line lang=wikitext>{{G| | ||
Structural-Iceberg-ca.svg|{{Plainlinks|http://lightningvolt.com/Image%20Gallery/imagegallery.htm|URL 1}} | Structural-Iceberg-ca.svg|{{Plainlinks|http://lightningvolt.com/Image%20Gallery/imagegallery.htm|URL 1}} | ||
Structural-Iceberg-cs.svg|{{W|{{#language:cs}}}} | Structural-Iceberg-cs.svg|{{W|{{#language:cs}}}} | ||
Structural-Iceberg.svg|{{Plainlinks|1=https://npgallery.nps.gov/AssetDetail/NRIS/1111|2=NRHP}} | Structural-Iceberg.svg|{{Plainlinks|1=https://npgallery.nps.gov/AssetDetail/NRIS/1111|2=NRHP}} | ||
Structural-Iceberg-ja.svg|{{#language:ja}} | Structural-Iceberg-ja.svg|{{#language:ja}} | ||
|w=48|m=n}}</ | |w=48|m=n}}</syntaxhighlight> | ||
|} | |} | ||
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| | <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| | ||
Revision as of 11:13, 21 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.
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 with 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
Defaulting the "format"
The parameter format 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".
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.
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!
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
<gallery> tag, if any are required the align attribute of tables can be used, e.g. {|
|style="padding-left:2em"|{{G| … }}
|}
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}}
- Module: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.
Examples
See here for different parameterisations and item notations, separated with pipes (|) and linefeeds (¶).
Just one file without option parameters {{G|
Example.png
}}
<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
|f=0|w=48|m=n|c=eight smileys                        }}
|
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. The input is easy to read this way and does not need the 'format' parameter. Namespace ("file" or "image") won't disturb. {{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}}
|
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}}
|