Template:Infobox/doc: Difference between revisions

Content deleted Content added
m 1 revision imported
De-Wikipediaify
Line 1:
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{distinguish|Template:Userbox|Template:Navbox}}
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{Lua|Module:Infobox}}
Line 17:
}}
 
This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. [[w:Help:Infobox|Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[w:Wikipedia:Manual of Style/Infoboxes|Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WPProgressbar95 Wiki:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes.
 
== Usage ==
{{tlf|Infobox}} is a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|Infobox buildingVersion}}).
 
For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified:
Line 52:
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):
 
; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[w:Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative.
; above : Text to put within the uppermost cell of the table.
; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images.
Line 121:
</syntaxhighlight>{{clear}}
 
It is also possible to automatically renumber parameter names by using [[w:User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]].
 
There is no upper limit on numbers but there must be at most 50 between each used number.
Line 142:
</syntaxhighlight>{{clear}}
 
For more on #if, see [[metamw:Help:Extension:ParserFunctions##if:|here]].
 
==== Hiding headers when all its data fields are empty ====
Line 270:
{{div col end}}
 
=== HTML classes and microformats ===
{{div col}}
; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
Line 289:
; belowclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''below''' cell.
{{div col end}}
 
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.
 
To flag an infobox as containing [[hCard]] information, for example, add the following parameter:
 
<syntaxhighlight lang="wikitext" style="overflow:auto">
| bodyclass = vcard
</syntaxhighlight>{{clear}}
 
And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:
 
<syntaxhighlight lang="wikitext" style="overflow:auto">
| class1 = fn
| class2 = org
| class3 = tel
</syntaxhighlight>{{clear}}
 
...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.
 
See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general.
 
== Examples ==
Line 570 ⟶ 550:
Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using {{para|rowstyleN|display: none}}, replacing N with the data/header number.
 
[[w:Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.
 
== Subboxes ==
Line 660 ⟶ 640:
 
== Controlling line-breaking in embedded bulletless lists ==
Template {{tlx|nbsp}} may be used with {{tlx|wbr}} and {{tlx|nowrap}} to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in {{tlx|Infobox film}}), to prevent wrapped long entries from being confused with multiple entries. See [[w:Template:Wbr/doc#Controlling line-breaking in infoboxes]] for details.
 
== Full blank syntax ==
Line 761 ⟶ 741:
 
== Porting to other MediaWikis ==
The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] extension. [[w:Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis.
 
== TemplateData ==
Line 800 ⟶ 780:
 
==Tracking categories==
* {{Category link with count|Articles with missing Wikidata information}}
* {{Category link with count|Articles using infobox templates with no data rows}}
* {{Category link with count|Pages using embedded infobox templates with the title parameter}}
 
==See also==
* [[Module:Infobox]], the [[w:WP:LUA|Lua]] module on which this template is based
* [[Module:Check for unknown parameters]]
* {{tl|Infobox3cols}}
* {{tl|Navbox}} and {{tl|Sidebar}}
* [[WikipediaProgressbar95 Wiki:List of infoboxes|List of infoboxes]]
* [[:Module:InfoboxImage]]
 
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Infobox templates| ]]
[[Category:Wikipedia metatemplates|Infobox]]
[[Category:Templates generating microformats]]
[[Category:Templates that add a tracking category]]
[[Category:Templates based on the Infobox Lua module]]
 
}}</includeonly>