From Arms of God Wiki

bot: doc cleanup (escape examples, drop charinsert)
bot: documentation pass — editor-facing docs (data descriptions, module comments, template usage, Help rewrite)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly><div class="infobox" style="border:2px solid var(--infobox-border, #3a3c44);background:var(--infobox-bg, #1c1d22);color:var(--infobox-text, #e6e6e6);padding:0.5em;float:right;width:280px;">
====================================================================
LIBRARY TEMPLATE: base_infobox
F-classes prevented:
  F2  — icon row never uses {{!}} as a #if separator; {{!}} appears
        ONLY inside [[File:...]]'s internal pipes (the only context
        where MediaWiki expands it correctly).
  F9  — every body row uses PATTERN B: row markers (|-, !, |) are
        OUTSIDE the #if, and only the VALUE is conditionalized.
        Never put |- or an unescaped | inside any {{#if:}} body.
 
Phase 4.5 contract:
  Every template parameter the wiki-builder passes here is a
  pre-resolved string (locale keys resolved, effect templates
  substituted, image res:// paths turned into wiki File: basenames).
  This template never resolves a key, never looks up an image; it
  only formats the values its caller already shaped.
 
Consumes plan.json fields:
  categories[].infobox_fields[]  — one |-..| row per field, in order
                                    (each field's label becomes the
                                    template parameter name)
  categories[].slug_rule          — supplies the bare display name
                                    via {{{name}}} parameter
 
Colors:
  Header/border/background colors come from CSS variables defined in
  MediaWiki:Common.css (--infobox-border / --infobox-bg /
  --infobox-header-bg / --infobox-header-fg). This template ships NO inline
  hex — edit the tokens in Common.css to restyle every infobox at once. When
  Common.css is not loaded (manifest.runtime.css_edit_allowed=false) the
  infobox renders unthemed (default border/no header tint), which is fine.
 
Slots the wiki-builder fills before emit:
  {{display_name}}        (optional) game name in footer
  {{developer_credit}}    (optional) game dev credit
  |-
! Type
| {{#if:{{{Type|}}}|{{{Type}}}|—}}
|-
! Availability
| {{#if:{{{Availability|}}}|{{{Availability}}}|—}}
|-
! Stats
| {{#if:{{{Stats|}}}|{{{Stats}}}|—}}      one Pattern B row per infobox_fields[]
                          entry, in plan order
 
Template parameters (passed by the invoking Module via
{{Template:..|name=...|id=...|icon=...|<Label1>=...|<Label2>=...}}):
  name      reader-facing display name (REQUIRED — header)
  id        internal id, rendered small under name (optional)
  icon      wiki File: basename for the entity icon (optional)
  desc      a short description string, rendered italic under the box
  <Label>    one per infobox_fields[] entry; param name is the plan's
            `field` label (NOT the `source` field name). The renderer
            always emits the row; empty values fall back to em-dash.
 
PATTERN B rule (mandatory; do not deviate):
  |-
  ! <Label>
  | {{#if:{{{<Label>|}}}|{{{<Label>}}}|—}}
 
  The row markers (|-, !, |) are OUTSIDE the #if. Only the VALUE
  inside the cell is conditional. This produces a consistent infobox
  shape on every page; missing data shows an em-dash instead of
  silently vanishing.
====================================================================
--><div class="infobox" style="border:2px solid var(--infobox-border);background:var(--infobox-bg);padding:0.5em;float:right;width:280px;">
{| style="width:100%;"
{| style="width:100%;"
! colspan="2" style="background:var(--infobox-header-bg);color:var(--infobox-header-fg);font-size:1.2em;text-align:center;" | {{{name|}}}
! colspan="2" style="{{#switch:{{{Type|}}}|Unique=background:#e94040;color:#ffffff;|Buff=background:#69c343;color:#000000;|Debuff=background:#bbbbbb;color:#000000;|Aura=background:#7b9fe0;color:#000000;|Action=background:#3a3c44;color:#ffffff;|#default=background:var(--infobox-header-bg, #26272e);color:var(--infobox-header-fg, #f1e9d2);}}font-size:1.2em;text-align:center;" | {{{name|}}}
|-
|-
| colspan="2" style="text-align:center;" | {{#if:{{{icon|}}}|[[File:{{{icon}}}{{!}}96px{{!}}alt={{{name|}}}]]|—}}
| colspan="2" style="text-align:center;" | {{#if:{{{icon|}}}|[[File:{{{icon}}}{{!}}96px{{!}}alt={{{name|}}}]]|—}}
|-
| colspan="2" style="text-align:center;padding:3px 0;" | {{#if:{{{Type|}}}|{{#switch:{{{Type}}}|Unique=<span style="display:inline-block;padding:1px 8px;border-radius:3px;font-size:0.85em;font-weight:bold;background:#e94040;color:#ffffff;">Unique</span>|Buff=<span style="display:inline-block;padding:1px 8px;border-radius:3px;font-size:0.85em;font-weight:bold;background:#69c343;color:#000000;">Buff</span>|Debuff=<span style="display:inline-block;padding:1px 8px;border-radius:3px;font-size:0.85em;font-weight:bold;background:#bbbbbb;color:#000000;">Debuff</span>|Aura=<span style="display:inline-block;padding:1px 8px;border-radius:3px;font-size:0.85em;font-weight:bold;background:#7b9fe0;color:#000000;">Aura</span>|Action=<span style="display:inline-block;padding:1px 8px;border-radius:3px;font-size:0.85em;font-weight:bold;background:#3a3c44;color:#ffffff;">Action</span>|#default={{{Type}}}}}|}}
|-
|-
| colspan="2" style="text-align:center;" | <small><code>{{{id|}}}</code></small>
| colspan="2" style="text-align:center;" | <small><code>{{{id|}}}</code></small>
Line 86: Line 21:
{{#if:{{{desc|}}}|''{{{desc}}}''|}}
{{#if:{{{desc|}}}|''{{{desc}}}''|}}
</includeonly><noinclude>
</includeonly><noinclude>
'''base_infobox''' — generic library infobox skeleton.
== What this template does ==
 
Renders the infobox panel at the top right of every Crux page. You normally never call it by hand: each detail page calls <code><nowiki>{{#invoke:Crux|infobox|id=<slug>}}</nowiki></code>, and [[Module:Core]] computes the values from [[Data:Crux.json]] at render time, then passes them to this template as parameters. This template is presentation only — row layout, header color, em-dash fallbacks. To change a VALUE, edit the source Data page; to change WHICH fields are computed, edit Module:Core; to change how the box looks, edit here.
The wiki-builder inserts per-category rows at `|-
! Type
| {{#if:{{{Type|}}}|{{{Type}}}|—}}
|-
! Availability
| {{#if:{{{Availability|}}}|{{{Availability}}}|—}}
|-
! Stats
| {{#if:{{{Stats|}}}|{{{Stats}}}|—}}`. Colors are driven by `--infobox-*` CSS variables in `MediaWiki:Common.css`, not inline hex see the header comment. Each generated row MUST follow Pattern B (see header comment). Template parameter names are the plan's `field` labels (`Tier`, `Damage`, `Effects`), not the raw `source` field names from the data.


Every row that the builder emits comes from a single `infobox_fields[]` entry in `plan.json`. Importance:
== Parameters ==
* <code>name</code> — display name, shown in the colored header.
* <code>id</code> — the game's internal id, shown small under the icon.
* <code>icon</code> — <code>File:</code> image name for the entity's icon.
* <code>Type</code>
* <code>Availability</code>
* <code>Stats</code>


* `must` — always emit row; value defaults to em-dash when missing.
If you add or remove a row here, keep Module:Core's <code>INFOBOX_FIELD_ORDER.Crux</code> list in sync that list decides which computed values get passed in.
* `optional` — always emit row; value defaults to em-dash when missing. (Same Pattern B shape uniform infobox shape is more important than hiding rows.)
* `hidden` — do not emit the row at all.


Values arrive pre-resolved from Phase 4.5: no `tr()` calls, no template substitution, no res:// paths. The template just renders what it was passed.
== Row shape ==
Every body row follows this exact shape (keep it when adding rows):
<pre>
|-
! Label
| {{#if:{{{Label|}}}|{{{Label}}}|—}}
</pre>
The row markers (<code>|-</code>, <code>!</code>, <code>|</code>) stay OUTSIDE the <code>#if</code>; only the value is conditional. Missing data then shows an em-dash instead of breaking the table layout.


For boolean-presence fields where the plan wants both states displayed (e.g. "Cursed" vs "Normal"), use <code>boolean_row.wiki</code>. For the icon row, use the snippet at <code>icon_row.wiki</code> — it is the ONLY shape allowed for icon rows.
== Styling ==
Colors come from the site theme tokens (<code>var(--infobox-*, fallback)</code> — defined in [[MediaWiki:Common.css]], with inline fallbacks so the box renders correctly even without site CSS).
</noinclude>
</noinclude>

Latest revision as of 16:04, 10 June 2026

What this template does

Renders the infobox panel at the top right of every Crux page. You normally never call it by hand: each detail page calls {{#invoke:Crux|infobox|id=<slug>}}, and Module:Core computes the values from Data:Crux.json at render time, then passes them to this template as parameters. This template is presentation only — row layout, header color, em-dash fallbacks. To change a VALUE, edit the source Data page; to change WHICH fields are computed, edit Module:Core; to change how the box looks, edit here.

Parameters

  • name — display name, shown in the colored header.
  • id — the game's internal id, shown small under the icon.
  • iconFile: image name for the entity's icon.
  • Type
  • Availability
  • Stats

If you add or remove a row here, keep Module:Core's INFOBOX_FIELD_ORDER.Crux list in sync — that list decides which computed values get passed in.

Row shape

Every body row follows this exact shape (keep it when adding rows):

|-
! Label
| {{#if:{{{Label|}}}|{{{Label}}}|—}}

The row markers (|-, !, |) stay OUTSIDE the #if; only the value is conditional. Missing data then shows an em-dash instead of breaking the table layout.

Styling

Colors come from the site theme tokens (var(--infobox-*, fallback) — defined in MediaWiki:Common.css, with inline fallbacks so the box renders correctly even without site CSS).