From Feed The Beast Wiki
< Module:Infobox
Revision as of 02:43, 17 March 2017 by Kythyria (talk | contribs) (Fiddle with markup)
Jump to: navigation, search

This is the documentation page for Module:Infobox

This module implements all of the infoboxes. Individual infoboxes are defined on subpages of this page, and MUST be marked translatable, or you will get an error when trying to use them, as the module reads the translations exclusively.



Expands to the infobox defined by the subpage boxName. When creating the template wrappers, supply fromParent=1 instead of the parameters directly. This will cause the infobox to take its parameters from the ones supplied to the wrapper.


Expands to a documentation page for boxname.


List the parameters available in a suitable form for template documentation.


Produce an infobox with all the parameter names shown.

Format of infobox definitions

Please note that any translatable text MUST use multiline string syntax with at least one = in it. That is, rather than "string", do [=[string]=]. This is because the translate extension inserts linebreaks, which are not compatible with quotes, and the [[string]] syntax breaks if it contains any wikitext links.

Fields listed as wikitext are strings, but ones in which it is reasonable to put wikitext. Templates should work in most of them.

Each definition is a Lua module, so it has to return a table. Typically this is done by:

local box = {}
-- box definition is here
return box

The contents of this table are as following:

docLeadWikitextLead section of the documentation (the hatnote and "This template is used to create an infobox..." text are inserted for you).
parameterLeadWikitextText immediately preceding the parameter list (the "an empty infobox..." text is also inserted automatically)
parameterTrailWikitextText immediately following the parameter list.
formatFormat tableDetails of the infobox (see the next section)
examplesTable of examplesExamples to place in the documentation. Each example is a table containing an optional description in the text key, and some wikitext to use as an example in the first indexed entry. For example:
{ text="Demonstration of hatnote", ":''This article is about the wiki concept. For sticking notes on actual hats, see [[Hat#Annotating]]''" }

Format of infobox details

This is also a table, containing a list of sections; a section is the part of the infobox that is headed by a blue header. Each section is a table, with the following contents. "Argument" denotes a field that can be either an argument table (see below), or wikitext.

nameStringName that appears as a header in the documentation. Consecutive sections with identical names will be merged into one in the documentation.
titleArgumentMandatory. The heading for a section (ie, the bit that appears in the blue bar).
descWikitextOptional. Explanatory text which will appear in the documentation for this section.
noDocBooleanOptional. If present, don't show this section in the documentation at all.
docOnlyBooleanOptional. If present, this section is not treated as part of the infobox, but documentation is still shown for it.
IndexedSubsection tableThe subsections to display. You need at least one of these.

Subsections can contain desc noDoc and docOnly keys, and contain a list of rows (again, you need at least one). Rows can also contain those three keys, and contain one or two Arguments as indexed entries. If one, then it will be centered across the width of the infobox, using the colspan parameter in the generated cell.

Format of Arguments

An argument which is not a string is a table referring to a template parameter supplied to an invocation of infobox, the value of this parameter being used as if it had been given in place of the table.

argString or table of stringsThe name of the template parameter. If you give a table here, its indexed parameters will be used as synonyms, with the first being the canonical name.
typeOne of:
How the argument will be interpreted. text is just wikitext. image will treat it as the name of an image. switch will look it up in the allowedValues parameter. switch will also add to if an invalid value is given for the parameter (but not none at all). link will treat it as the URL of an external link. templateCall will treat it as the lone argument to the template given in the template member. number will treat the value as purely a number and separate it by commas.
styleStringCSS to insert in the table cell's style attribute.
maxSizeNumberMaximum size of an image in pixels. Omit the px, it will be added for you.
imageParametersStringAdditional parameters to add to the image. Use pipes to separate them, as you would in wikitext (but you don't need to start or end with one).
allowedValuesTable of stringsPermitted values for a switch. Mandatory for switches, pointless otherwise. The value given as a template parameter will be used as a key into this table, and the value will be displayed. A listing of keys and values will be entered into the documentation.
descWikitext (no templates)Description to displayed in the listing of parameters in the documentation. If omitted, then no entry will be displayed at all.
noDocBooleanIf present, the argument will not be mentioned in the documentation. Overrides the presence of desc.
linkTextStringIf the type is link use this as the link text.
prefixStringPrepend this text, followed by a space, to the argument's value.
unitsStringAppend a space and then this text, to the argument's value.
templateStringName of template to expand.