Module:Equipment re-renders every {{ItemInfobox}} block from a section of a category template, so class pages and listing pages stay automatically in sync with the item templates.

Overview

The wiki keeps each item's infobox once, inside a category template such as Template:Swords/Weapons or Template:Untiered/Heavy/Armours. Those templates are split into named sections (e.g. Untiered, Helmets, Chestplates) separated by |-| table-row markers.

This module lets another page pull just one section of one of those templates and display all the {{ItemInfobox}} blocks it contains. The main use is on class pages (Knight, Assassin, Huntress, Arcanist, Necromancer, Samurai, etc.), which list the gear a class can use by pointing at the relevant section of each category template. Because the items are read live from the source template, the class page never needs to be edited when an item is added or changed — it always mirrors the template.

Functions / entry points

Function (#invoke) What it does Called by
p.section Loads Template:<arg1>, optionally narrows it to the section named by arg2, finds every Template:ItemInfobox... block in that range, wraps them in a
, and renders them. Returns No items. if the template/section is missing or empty.
Class pages, e.g. {{Knight}}, {{Assassin}}, {{Huntress}}, {{Arcanist}}, {{Necromancer}}, {{Samurai}}

How it's used

No items.

Real examples from class pages:

{{#invoke:Equipment|section|Swords/Weapons|Untiered}}
{{#invoke:Equipment|section|Untiered/Heavy/Armours|Helmets}}
{{#invoke:Equipment|section|Cloaks/Abilities|Untiered}}
  • Argument 1 is the category template title without the Template: prefix (the module adds it). Slashes are kept as-is, so Swords/Weapons means Template:Swords/Weapons.
  • Argument 2 is the section name to extract. If omitted (or empty) the whole template is scanned. The section is delimited by a line matching <Section> = at the start and the next |-| row marker.

Editors normally just place these invoke lines on a class/listing page (or inside a tabber). The actual item data is edited in the category templates, not here.

Notes

  • Section extraction is purely text-based: it looks for a line beginning with the section name followed by =, then cuts off at the next \n|-| marker. The section names therefore must match the labels used in the category template's tabber rows.
  • It collects content by matching Template:ItemInfobox(.-), so only {{ItemInfobox}} blocks are picked up. Each block is then expanded normally, so it renders through {{Infobox}}m like any other item infobox.
  • Output is wrapped in
    for the grid styling used on listing pages.
  • Related modules: {{Shinies}}m (same pattern, but only emits the Shiny version of untiered items), {{Reskins}}m (lists/renders reskin variants), and {{Infobox}}m (the engine that actually renders each block).

local p = {}

-- Renders every {{ItemInfobox}} block from a section of a category template,
-- so class pages stay 1:1 with the source templates automatically.
-- Usage: {{#invoke:Equipment|section|Swords/Weapons|Untiered}}
--        {{#invoke:Equipment|section|Untiered/Heavy/Armours|Helmets}}
function p.section(frame)
	local title = mw.text.trim(frame.args[1] or '')
	local section = mw.text.trim(frame.args[2] or '')
	if title == '' then return '' end
	local page = mw.title.new('Template:' .. title)
	local content = page and page:getContent()
	if not content then return "''No items.''" end
	if section ~= '' then
		local s = content:find('\n' .. section .. '%s*=')
		if not s then return "''No items.''" end
		content = content:sub(s + 1)
		local e = content:find('\n|%-|')
		if e then content = content:sub(1, e - 1) end
	end
	local out = {}
	for block in content:gmatch('{{ItemInfobox(.-)}}') do
		out[#out + 1] = '{{ItemInfobox' .. block .. '}}'
	end
	if #out == 0 then return "''No items.''" end
	return frame:preprocess('<div class="display-items">\n' .. table.concat(out, '\n') .. '\n</div>')
end

return p