imported>RheingoldRiver Adding default set of pages |
the mass documenting |
||
| Line 1: | Line 1: | ||
{{ | '''Module:Infobox is the DRUID-style layout engine that turns the simple parameters of an infobox template (such as {{tl|ItemInfobox}} or {{tl|NPCInfobox}}) into a full, tabbed, styled infobox.''' | ||
__TOC__ | |||
== Overview == | |||
This module builds the boxes you see in the top corner of item, weapon, armour and boss/NPC pages. It is the local copy of the "DRUID" infobox framework: a generic system that takes a list of '''sections''', a list of '''data fields''' inside each section, and an optional set of '''tabs''' (e.g. the Tiered / Untiered / Shiny tabs on item pages), and outputs the HTML/CSS the wiki's styles and gadgets know how to display. | |||
Editors almost never call this module directly. Instead they fill in a friendly wrapper template: | |||
* {{tl|ItemInfobox}} — weapons, abilities and armour. Its source contains the long {{#invoke:Infobox|main ...}} call with all the section/field plumbing already wired up. | |||
* {{tl|NPCInfobox}} — bosses and NPCs ({{tl|BossInfobox}} is a redirect to it). | |||
Those wrapper templates do all the work of mapping a handful of human-friendly parameters (title, images, Desc, Stats, Drop, etc.) onto the many low-level parameters this module expects. If you only want to document an item or a boss, edit the page that uses the wrapper template — you should not need to touch this module. | |||
The module also tags every page that uses it with <code>[[Category:Pages with DRUID infoboxes]]</code> (used for maintenance and for loading the interactive tab/worn-toggle gadget). | |||
== Functions / entry points == | |||
{| class="wikitable" | |||
! Function (#invoke) !! What it does !! Called by | |||
|- | |||
| <code>p.main</code> || The main entry point. Reads all parameters, splits the sections/fields/tabs, assigns the infobox a unique id, optionally sets the page's main image, and renders the whole infobox. Returns the infobox plus the tracking category. || {{tl|ItemInfobox}}, {{tl|NPCInfobox}} | |||
|- | |||
| <code>p.arraymap</code> || A Lua re-implementation of Page Forms' <code>#arraymap</code>: splits argument 1 on a separator, substitutes each piece into a pattern, and re-joins. A general utility; not the main rendering path. || (helper; available for templates that need arraymap behaviour) | |||
|- | |||
| <code>p.preprocess</code> || Expands (preprocesses) the wikitext passed as its first argument. A small utility for templates that need to force expansion of a value. || (helper) | |||
|} | |||
Everything else in the module is internal (the <code>h.*</code> helper functions): splitting argument lists, building each section, handling tabs, choosing <code><div></code> vs <code><table></code> markup, escaping CSS class names, and so on. These are not <code>#invoke</code> entry points. | |||
== How it's used == | |||
The wrapper template holds the real call. For example, {{tl|ItemInfobox}} contains (abbreviated): | |||
<pre> | |||
{{#invoke:Infobox|main | |||
|kind=item | |||
|class=item-infobox | |||
|sep=; | |||
|images=... (built from the template's |images= parameter) | |||
|tabs=... (the tab labels, e.g. Tiered / Untiered) | |||
|sections=Description;Stats;Abilities;Reskins;Info | |||
|Description=Unholy;Voidbound;Bloodshot;Royal;...;Desc | |||
|Stats=Type;Attack;Defense;...;Range;Velocity | |||
|Abilities=Ability;SP | |||
|Reskins=ReskinList | |||
|Info=Drop;TP;Classes | |||
... | |||
}} | |||
</pre> | |||
Key concepts visible there: | |||
* <code>|sep=;</code> — the separator used to split lists (this infobox uses a semicolon instead of the default comma, because field values themselves contain commas). | |||
* <code>|sections=...</code> — the ordered list of sections to render. | |||
* <code>|<Section>=field1;field2;...</code> — the data fields that belong to each section. | |||
* <code>|<field>_label=</code>, <code>|<field>_nolabel=true</code>, etc. — per-field display options. | |||
* <code>|tabs=</code> / <code>|<tab>_<field>=</code> — values that differ per tab. | |||
'''Ordinary editors should not write <code>{{#invoke:Infobox|...}}</code> by hand.''' Put item or boss data into {{tl|ItemInfobox}} / {{tl|NPCInfobox}} and let those templates call this module. | |||
== Notes == | |||
* '''Automatic Shiny tab.''' If an infobox has exactly one image whose file name starts with <code>Ut-</code> (the untiered-item naming scheme, e.g. <code>Ut-Onyxblade.png</code>) and a matching <code>File:ShinyUt-...png</code> exists on the wiki, the module automatically adds a second image and a "Shiny" tab (labels become Untiered / Shiny). This is why untiered items get a Shiny toggle without any extra parameters. | |||
* '''Automatic Worn variant.''' For any image <code>File:Name.ext</code>, if a <code>File:NameWorn.ext</code> exists, the module adds a "Show Worn" toggle button so armour can show its worn-on-character sprite. | |||
* '''Main image.''' Unless <code>|setmainimage=no</code>, the first image is registered as the page's main image (used for social/share previews) via <code>#setmainimage</code>; this fails silently if the wiki lacks that parser function. | |||
* '''div vs table.''' By default the module emits <code><div></code>-based markup (<code>USE_DIVS = true</code> at the top of the file). This can be overridden globally in the module or per-infobox with <code>|useDivs=yes/no</code>. | |||
* '''Unique ids.''' Each infobox on a page gets an incrementing <code>DRUID_INFOBOX_ID</code> (via the Variables extension if present, otherwise a fallback) so multiple infoboxes and their tabs don't collide. | |||
* '''Optional hooks.''' If <code>Module:Infobox/Hooks</code> exists, its functions are called at defined points (onCastArgsStart/End, onMakeOutputStart/End) to let a wiki customise behaviour without editing this module. | |||
* '''Related:''' {{tl|ItemInfobox}}, {{tl|NPCInfobox}}/{{tl|BossInfobox}}, and the per-item display modules {{ml|Equipment}} and {{ml|Shinies}} (which collect {{tl|ItemInfobox}} blocks from category templates), and {{ml|Reskins}} (which feeds reskin data into {{tl|ItemInfobox}}). | |||
Latest revision as of 11:54, 20 June 2026
Module:Infobox is the DRUID-style layout engine that turns the simple parameters of an infobox template (such as {{ItemInfobox}} or {{NPCInfobox}}) into a full, tabbed, styled infobox.
Overview
This module builds the boxes you see in the top corner of item, weapon, armour and boss/NPC pages. It is the local copy of the "DRUID" infobox framework: a generic system that takes a list of sections, a list of data fields inside each section, and an optional set of tabs (e.g. the Tiered / Untiered / Shiny tabs on item pages), and outputs the HTML/CSS the wiki's styles and gadgets know how to display.
Editors almost never call this module directly. Instead they fill in a friendly wrapper template:
{{ItemInfobox}}— weapons, abilities and armour. Its source contains the long Script error: The function "main ..." does not exist. call with all the section/field plumbing already wired up.{{NPCInfobox}}— bosses and NPCs ({{BossInfobox}}is a redirect to it).
Those wrapper templates do all the work of mapping a handful of human-friendly parameters (title, images, Desc, Stats, Drop, etc.) onto the many low-level parameters this module expects. If you only want to document an item or a boss, edit the page that uses the wrapper template — you should not need to touch this module.
The module also tags every page that uses it with (used for maintenance and for loading the interactive tab/worn-toggle gadget).
Functions / entry points
| Function (#invoke) | What it does | Called by |
|---|---|---|
p.main |
The main entry point. Reads all parameters, splits the sections/fields/tabs, assigns the infobox a unique id, optionally sets the page's main image, and renders the whole infobox. Returns the infobox plus the tracking category. | {{ItemInfobox}}, {{NPCInfobox}}
|
p.arraymap |
A Lua re-implementation of Page Forms' #arraymap: splits argument 1 on a separator, substitutes each piece into a pattern, and re-joins. A general utility; not the main rendering path. |
(helper; available for templates that need arraymap behaviour) |
p.preprocess |
Expands (preprocesses) the wikitext passed as its first argument. A small utility for templates that need to force expansion of a value. | (helper) |
Everything else in the module is internal (the h.* helper functions): splitting argument lists, building each section, handling tabs, choosing
vs markup, escaping CSS class names, and so on. These are not #invoke entry points.
How it's used
The wrapper template holds the real call. For example, {{ItemInfobox}} contains (abbreviated):
{{#invoke:Infobox|main
|kind=item
|class=item-infobox
|sep=;
|images=... (built from the template's |images= parameter)
|tabs=... (the tab labels, e.g. Tiered / Untiered)
|sections=Description;Stats;Abilities;Reskins;Info
|Description=Unholy;Voidbound;Bloodshot;Royal;...;Desc
|Stats=Type;Attack;Defense;...;Range;Velocity
|Abilities=Ability;SP
|Reskins=ReskinList
|Info=Drop;TP;Classes
...
}}
Key concepts visible there:
|sep=; — the separator used to split lists (this infobox uses a semicolon instead of the default comma, because field values themselves contain commas).
|sections=... — the ordered list of sections to render.
|<Section>=field1;field2;... — the data fields that belong to each section.
|<field>_label=, |<field>_nolabel=true, etc. — per-field display options.
|tabs= / |<tab>_<field>= — values that differ per tab.
Ordinary editors should not write Script error: The function "..." does not exist. by hand. Put item or boss data into {{ItemInfobox}} / {{NPCInfobox}} and let those templates call this module.
Notes
- Automatic Shiny tab. If an infobox has exactly one image whose file name starts with
Ut- (the untiered-item naming scheme, e.g. Ut-Onyxblade.png) and a matching File:ShinyUt-...png exists on the wiki, the module automatically adds a second image and a "Shiny" tab (labels become Untiered / Shiny). This is why untiered items get a Shiny toggle without any extra parameters.
- Automatic Worn variant. For any image
File:Name.ext, if a File:NameWorn.ext exists, the module adds a "Show Worn" toggle button so armour can show its worn-on-character sprite.
- Main image. Unless
|setmainimage=no, the first image is registered as the page's main image (used for social/share previews) via #setmainimage; this fails silently if the wiki lacks that parser function.
- div vs table. By default the module emits
-based markup (USE_DIVS = true at the top of the file). This can be overridden globally in the module or per-infobox with |useDivs=yes/no.
- Unique ids. Each infobox on a page gets an incrementing
DRUID_INFOBOX_ID (via the Variables extension if present, otherwise a fallback) so multiple infoboxes and their tabs don't collide.
- Optional hooks. If
Module:Infobox/Hooks exists, its functions are called at defined points (onCastArgsStart/End, onMakeOutputStart/End) to let a wiki customise behaviour without editing this module.
- Related:
{{ItemInfobox}}, {{NPCInfobox}}/{{BossInfobox}}, and the per-item display modules {{Equipment}}m and {{Shinies}}m (which collect {{ItemInfobox}} blocks from category templates), and {{Reskins}}m (which feeds reskin data into {{ItemInfobox}}).