Template:Infobox

From Wikinews, the free news source you can write!
Jump to navigation Jump to search
[edit] Template-info.svg Template documentation
update use count

Usage

This template takes as its one parameter the name of a category, and generates a potentially customized infobox for that category. Customizations for any given category are specified in a simply formatted page for that category. Customizations do not involve passing additional parameters to {{infobox}}, and do not involve hacking esoteric internals of templates.

For example, {{infobox|Tuvalu}} would produce the infobox on the right.

To specify customizations for some category Foobar, create a page called Template:Infobox/lookup/Foobar, containing a call to template {{infobox table}} with parameters to that template specifying the customizations for the Foobar infobox. Template {{infobox table}} formats these parameters into a wikitable; see for example the customization page for Tuvalu, here.

If there is no customization page for the named category, customizations are read from the table at {{infobox/default}}.

(When editing a page containing a call {{infobox|Foobar}}, the Foobar infobox customization page appears under "templates used" even if the customization page has not been created.)

Internals

This template uses subtemplates to decompose its operation into manageable subtasks. The main template is responsible only for checking for a customization file and, if found, parsing it. The result, or non-result, of this parse is passed on to {{infobox/p1}}.

This template does not need to know the set of parameters used to customize the infobox. Those parameters are not passed to this template, and this template can parse a customizing table and pass on whatever parameters are specified by the customizing table, leaving it to subtemplates to worry about whether the parameters provided are valid. For explanations of the valid customization parameters, and how to change the set of them if necessary, see {{infobox table}}.

When parsing the customization file, square brackets [] and angle brackets <> are removed, isolating markup functions involving those characters in the central template; however, pipe characters | are left intact to allow customization of an image by means of field-display fields embedded in the image name, such as example.svg|border.

See also