Template:Infobox/doc: Difference between revisions

Ganaram inukshuk (talk | contribs)
No edit summary
Ganaram inukshuk (talk | contribs)
No edit summary
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{dochead}}{{lua}}
{{dochead | header = metatemplate }}
{{wikipedia}}
'''{{ARTICLEROOTPAGENAME}}''' is intended as a meta-template (i.e. a template intended mainly for constructing other templates). Although using [[Module:Infobox]] directly is the primary way to create infoboxes (such as those that automatically add entries), this template can be used standalone, such as with prototyping or making simple infoboxes. See [[:Category:Infoboxes]] to see all templates that generate infoboxes.{{clear}}
'''{{ARTICLEROOTPAGENAME}}''' is intended as a meta-template (i.e. a template intended mainly for constructing other templates). Although using [[Module:Infobox]] directly is the primary way to create infoboxes (such as those that automatically add entries), this template can be used standalone, such as with prototyping or making simple infoboxes. See [[:Category:Infoboxes]] to see all templates that generate infoboxes.{{clear}}


== Parameters ==
== Parameters ==
; <code>name</code> (optional)
: The template's name, needed to create its view/talk/edit links.


; <code>Title</code> (recommended; default <code>Infobox Title</code>)
; <code>Title</code> (recommended; default <code>Infobox Title</code>)
Line 19: Line 17:
: Text for a row's header cell and data cell. A row's header cell may be omitted for simple infoboxes. Up to 30 rows are supported using the template.
: Text for a row's header cell and data cell. A row's header cell may be omitted for simple infoboxes. Up to 30 rows are supported using the template.


== Basic usage ==
; <code>name</code> (optional)
: The template's name, needed to create its view/talk/edit links.
 
== Usage ==


=== Simple infoboxes ===
=== Infobox rows ===
Rows in an infobox can be added by adding parameters <code>Header ''N''</code> and <code>Row ''N''</code>. Up to 30 rows can be added, each with a separate header and data entry.
Rows in an infobox can be added by adding parameters <code>Header ''N''</code> and <code>Row ''N''</code>. Up to 30 rows can be added, each with a separate header and data entry.
An optional <code>Header Row</code> and <code>Footer Row</code> may also be added. Infoboxes that display complex information may have its template name passed into itself to provide navbar links.


{{Infobox
{{Infobox
| Title=3/2
| Title=3/2
| Header Row = <hr>
| Header 1 = Size in cents
| Header 1 = Size in cents
| Data 1 = 701.9¢
| Data 1 = 701.9¢
Line 32: Line 36:
| Header 3 = Harmonic entropy
| Header 3 = Harmonic entropy
| Data 3 = 3.42385 bits
| Data 3 = 3.42385 bits
| Footer Row = Listen on Xencalc
| name = Infobox example
}}
}}


<pre>{{Infobox
<pre>{{Infobox
| Title=3/2
| Title=3/2
| Header Row = <hr>
| Header 1 = Size in cents
| Header 1 = Size in cents
| Data 1 = 701.9¢
| Data 1 = 701.9¢
Line 42: Line 49:
| Header 3 = Harmonic entropy
| Header 3 = Harmonic entropy
| Data 3 = 3.42385 bits
| Data 3 = 3.42385 bits
| Footer Row = Listen on Xencalc
| name = Infobox example
}}</pre>
}}</pre>


{{clear}}
{{clear}}


=== With navigation links ===
=== Navigation links ===
Basic navigation can be added by including <code><nowiki>Left Link</nowiki></code> and <code><nowiki>Right Link</nowiki></code>. Links may be omitted, such as with border cases.
Basic navigation can be added by including <code><nowiki>Left Link</nowiki></code> and <code><nowiki>Right Link</nowiki></code>. Links may be omitted, such as with border cases.


Line 76: Line 85:


{{Clear}}
{{Clear}}
==== Using numlinks ====
The templates [[Template:numlinks]] and [[Template:numlinks 2-num]] may be used to automatically generate links for numbered pages. If these templates are used in place of this template's <code>Link</code> parameters, it must be used as the infobox's <code>Title</code> to achieve the same formatting as using the <code>Link</code> parameters.
{{Infobox
| Title = Fractional-octave temperaments
| Data 1 =
  {{Numlinks
  | Current Num = 19
  | Link Format = %s-octave temperaments
  | Display Format = %s-octave
  | Current Page Format = %s-octave
  | Is Ordinal = 1
  | Is Table = false}}
}}
<pre>{{Infobox
| Title = Fractional-octave temperaments
| Data 1 =
  {{Numlinks
  | Current Num = 19
  | Link Format = %s-octave temperaments
  | Display Format = %s-octave
  | Current Page Format = %s-octave
  | Is Ordinal = 1
  | Is Table = false}}
}}</pre>
{{clear}}
{{Infobox
| Title=
  {{Numlinks 2-num
  | Current Num 1 = 5
  | Current Num 2 = 12
  | Link Format = %sL&nbsp;%ss}}
| Header 1= '''Scale info'''
| Header 2 = Step Pattern
| Data 2 = LssLssLsssLssLsss
}}
<pre>{{Infobox
| Title=
  {{Numlinks 2-num
  | Current Num 1 = 5
  | Current Num 2 = 12
  | Link Format = %sL&nbsp;%ss}}
| Header 1= '''Scale info'''
| Header 2 = Step Pattern
| Data 2 = LssLssLsssLssLsss
}}</pre>
{{clear}}


=== Headerless rows ===
=== Headerless rows ===
A row that only contains a <code>Data ''N''</nowiki></code> entry and no corresponding <code>Header ''N''</code> is interpreted as a headerless row. This can be used as separators for grouping related information or for information that does not require a header, such as external links.
A row that only contains a <code>Data ''N''</code> entry and no corresponding <code>Header ''N''</code> is interpreted as a headerless row. This can be used as separators for grouping related information or for information that does not require a header, such as external links.


{{Infobox
{{Infobox
Line 176: Line 131:
}}</pre>{{clear}}
}}</pre>{{clear}}


=== Navbar links ===
== Advanced usage ==


Complex infoboxes may have its template name passed into itself to provide view/talk/edit links. These links are placed at the bottom.
=== Using numlinks ===
 
The templates [[Template:numlinks]] and [[Template:numlinks 2-num]] may be used to automatically generate links for numbered pages. These templates may be placed in a <code>Data</code> row or as the <code>Title</code>.


{{Infobox
{{Infobox
| Title=12edo
| Title = Fractional-octave temperaments
| Header 1 = Size of fifth
| Header Row = <hr>
| Data 1 = 700¢
| Data 1 =
| Header 2 = Size of step
  {{Numlinks
| Data 2 = 100¢
  | Current Num = 19
| Left Link = &larr; 11edo
  | Link Format = %s-octave temperaments
| Right Link = 13edo &rarr;
  | Display Format = %s-octave
| name = Infobox example
  | Current Page Format = %s-octave
  | Is Ordinal = 1
  | Is Table = false}}
}}
 
<pre>{{Infobox
| Title = Fractional-octave temperaments
| Header Row = <hr>
| Data 1 =  
  {{Numlinks
  | Current Num = 19
  | Link Format = %s-octave temperaments
  | Display Format = %s-octave
  | Current Page Format = %s-octave
  | Is Ordinal = 1
  | Is Table = false}}
}}</pre>
 
{{clear}}
 
These templates can be used as the infobox's <code>Title</code>, producing the same result as using the infobox's <code>Link</code> parameters. As such, the <code>Link</code> parameters must not be used at the same time as using the numlinks templates as the <code>Title</code>.
 
{{Infobox
| Title =
  {{Numlinks 2-num
  | Current Num 1 = 5
  | Current Num 2 = 12
  | Link Format = %sL&nbsp;%ss}}
| Header 1 = '''Scale info'''
| Header 2 = Step Pattern
| Data 2 = LssLssLsssLssLsss
}}
}}


<pre>{{Infobox
<pre>{{Infobox
| Title=12edo
| Title =
| Header 1 = Size of fifth
  {{Numlinks 2-num
| Data 1 = 700¢
  | Current Num 1 = 5
| Header 2 = Size of step
  | Current Num 2 = 12
| Data 2 = 100¢
  | Link Format = %sL&nbsp;%ss}}
| Left Link = &larr; 11edo
| Header 1 = '''Scale info'''
| Right Link = 13edo &rarr;
| Header 2 = Step Pattern
| name = Infobox example
| Data 2 = LssLssLsssLssLsss
}}</pre>
}}</pre>
{{clear}}
== See also ==
* [[:Category:Infoboxes]], infoboxes, some of which use this template
* [[Template:Navbox]], a similar metatemplate for navboxes
* [[Template:Sidebar]], a similar template that may be used for navboxes that doesn't require two columns