Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:G/doc: Difference between revisions

Template page
+de
Prefix language interwiki links with w:
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
<!-- {{Underconstruction|date=2019-5-5|user=Sarang|notready=on|invite=Please wait a bit!{{0}}}}
<!-- {{Underconstruction|date=2019-5-5|user=Sarang|notready=on|invite=Please wait a bit!{{0}}}}
     {{redirects|gallery}} -->
     {{redirects|gallery}} -->
<div style="margin:0.5em; border:4px solid black; padding: 0.5em 1.5em 0.5em 0.5em; text-align:center;">
[[File:Kerze 2007k.JPG|30px|left]] The creator of the template User '''Sarang''' passed away on September 20, 2023, four months after working on this documentation. <br />
[[:w:de:Benutzer:Sarang/Kondolenzliste|Condolences]]</div>
{{TemplateBox
{{TemplateBox
|1      =1
|1      =1
Line 66: Line 69:
|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-td=Breite für die Displays
|8d-td-de=Breite für die Displays
|8aliases=widths
|8aliases=widths
|8stat  =optional-  
|8stat  =optional-  
Line 96: Line 99:
|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-t=wenn von einer Datei-Seite aufgerufen: Zeig das eigentliche Bild nicht an.
|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 113:
|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| ... }} more files are displayed.
* 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.
|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=
|i18n-method=-
|i18n-desc=
|seealso=
* {{T|F}} has a reduced [[Template:F#Gallery_style|Gallery Function]]
* {{T|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
}}


== 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 129:
# 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  
<div style="background-color:#cfc;width:52%;"><u>Note:</u> While options like "showfilename" or "mode=slideshow" are deprecated in namespaces as e.g. articles or galleries, they can be very useful in e.g. file descriptions, or talk pages.</div>  
{{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" =====
This parameter is a necessary addition to the parameters used by <code><nowiki><gallery></nowiki></code>.<br />
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 <nowiki><gallery></nowiki> is used, i.e.
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 140:
:::* ''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 <nowiki>{{G| ... }}</nowiki> is the almost same as with <nowiki><gallery> ... </gallery></nowiki>.<br />
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>'''".
<div style="background-color:#fe9;width:52%">{{0|MWMWMWM}}<u>Be aware:</u> There are other valid possibilities to specify the parameters;
{{Notice|1=There are other valid possibilities to specify the parameters;
::::but ''only the form as described above'' will result in the "format" defaulting.</div>  
::::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|...|file{{sub|n}}.ext|more parameters}}
;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 />...<br />file{{sub|n}}.ext<br />|more parameters}}
;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.


<div style="background-color:#cfc;width:60%;">The file names ("items") are specified with unnamed parameters.<br />
{{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.<br />
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}} }}
(See also the [[Template talk:G#Item separation|overview]]). </div>


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|...|file{{sub|n}}.ext|description{{sub|n}}|p8=&nbsp;f|2|more parameters}}
;List 3:  {{tle|T=G|file1.ext|description1|file2.ext|description2||file{{sub|n}}.ext|description{{sub|n}}|p8=&nbsp;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>&amp;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>&amp;nbsp;</code> will be used!  
<div style="background-color:#cfc;width:60%;">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 />
{{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.</div>
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 />...<br />| more parameters}}
:{{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 ''aligne attribute'' of tables can be used, e.g. <pre>
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| … }}
|}</pre>
|}</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=&nbsp;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>&amp;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 ==
Shows different parametrizings, and item notations (separation with "pipes" and linefeeds).
See here for different parameterisations and item notations, separated with pipes (|) and linefeeds ).
{| class="wikitable"}}
{| class="wikitable"
|-
|- style="vertical-align:top;"
|style="width:60%"|{{G|
|{{G|
Example.png}}  ||{{0}} <small>just one file without option parameters</small><br /><br /><nowiki>{{G|
Example.png}}  || Just one file without option parameters <syntaxhighlight copy line lang=wikitext>{{G|
Example.png}}</nowiki> <br /><br /><br /><small>That image can as well be obtained with</small><br /><nowiki><gallery mode="nolines" showfilename="yes"></nowiki><br /><nowiki>Example.png</gallery></nowiki>  
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}}  
|{{0}} <small>some files, without option parameters</small><br /><br /><br /><br /><nowiki>{{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}}</nowiki>
|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 282:
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 &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp;}} || <pre>{{G|Day-template.svg
|f=0|w=48|m=n|c=eight smileys &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp;}} || <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 290:
Line-style-icons-happy.svg
Line-style-icons-happy.svg
Nuvola emoticon - happy.svg
Nuvola emoticon - happy.svg
|c=eight smileys &amp;emsp; &amp;emsp;|f=0|w=48|m=n}}</pre>
|f=0|w=48|m=n|c=eight smileys &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp;}}</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}} || {{0}} <small>globally centered with </small> <code>a=c</code><br /><br /> <pre>
|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}}</pre>
|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 315:
Light green check.svg|green
Light green check.svg|green
|w=96}}
|w=96}}
|{{0}} <small>Some descriptions are missing</small> <br /><br /><br /><br /><pre>
| 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 328:
Orange check.svg|{{W|orange}}
Orange check.svg|{{W|orange}}
Light green check.svg|green
Light green check.svg|green
|w=96}}</pre><br /><br /><br />{{0}} <small>the input is easy to read this way</small><br />{{0}} <small>(and does not need the 'format' parameter)</small><br /><br />{{0}} namespace ("file" or "image") won't disturb
|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}}
|{{0}} <small>but not so easy to read that way:</small><br /><br /><pre>{{G|EU-section-with-A.svg|{{W|Austria}}|EU-section-with-BG.svg|{{W|Bulgaria}}|EU-section-with-CY.svg|{{W|Cyprus}}
| 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}}</pre>
|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;"
{| class="wikitable"
|{{G|
|-
|style="width:22%"|{{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}}           ||style="width:78%"|{{0}} <small>the description can also contain an</small> URL<br /><pre>{{G|
|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}}</pre>
|w=48|m=n}}</syntaxhighlight>
|}
|}
== See also ==
* {{tlx|Gallery}} and [[Module:Gallery]]


<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||

Latest revision as of 09:15, 12 August 2026

The creator of the template User Sarang passed away on September 20, 2023, four months after working on this documentation.
Condolences

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 {{ Gfilename }} a 'gallery' of a single file can be shown,
  • with e.g. {{ Gfilename1filename2 }} 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:

  1. no naming; same as specifying an empty f= , or another value
  2. naming with the "showfilename" option
  3. naming with the second value of parameter pairs (default is the first value, linked)
  4. same as format=2 but the defaults are displayed without link
  5. same as format=2 (default is the first value, linked, but without the extension)
  6. 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

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
{{ Gfile1.extfile2.extfilen.extmore 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
{{ Gfile1.extdescription1file2.extdescription2filen.extdescriptionn f = 2more 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. &nbsp; 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

Indentions are not intended by the <gallery> tag, if any are required the align attribute of tables can be used, e.g.
{|
|style="padding-left:2em"|{{G|}}
|}

Template parameters

ParameterDescriptionDefaultStatus
1(list of) file(s) to be displayed, can be in different ⇒ notationsemptysuggested
f
format
one of the six numbers to specify the ⇒ format: 0 to 5
whether or how the displayed image(s) should be captioned
1 or 2optional
m
mode
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=
emptyoptional
c
caption
gallery caption (may be shifted to the left with e.g. some trailing &emsp; entities)emptyoptional
p
perrow
pictures per rowemptyoptional
s
style
style attributes, e.g. s=float:rightemptyoptional
a
attr, class
class attributes: any wikimedia class;
or the special code "c" (a=c) for a global <center> tag
emptyoptional
w
widths
width for the displaysemptyoptional
h
heights
height for the displaysemptyoptional
d
display
display size; can specify widths and heightsemptyoptional
n
notself
when invoked from a file: don't display the image itselfemptyoptional
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

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
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

Displays a gallery of files, using just the conventional "gallery" tag, but with shorter parametrizing and some useful defaults.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
1

(list of) file(s) to be displayed, can be in different ⇒ notations

Unknownsuggested
a attr, class

class attributes: any wikimedia class; or the special code "c" ("a=c") for a global <center> tag

Unknownoptional
c caption

gallery caption (may be shifted to the left with e.g. some trailing &emsp; entities

Unknownoptional
d display

display size; can specify "widths" and "heights"

Unknownoptional
f format

one of the six numbers to specify the ⇒ format: 0 to 5, whether or how the displayed image(s) should be captioned

Default
1 or 2
Unknownoptional
h heights

height for the displays

Unknownoptional
m mode

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="

Unknownoptional
n notself

when invoked from a file: don't display the image itself

Unknownoptional
p perrow

pictures per row

Unknownoptional
s style

style attributes, e.g. "s=float:right"

Unknownoptional
w widths

width for the displays

Unknownoptional

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

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
}}
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
|f=0|w=48|m=n|c=eight smileys &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp;}}
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}}


Cookies help us deliver our services. By using our services, you agree to our use of cookies.