|
|
| 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
| |
| |-
| |
| ! Classification
| |
| | {{#if:{{{Classification|}}}|{{{Classification}}}|—}}
| |
| |-
| |
| ! 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, #3a3c44);background:var(--infobox-bg, #1c1d22);color:var(--infobox-text, #e6e6e6);padding:0.5em;float:right;width:280px;">
| |
| {| style="width:100%;" | | {| style="width:100%;" |
| ! colspan="2" style="background:var(--infobox-header-bg, #26272e);color:var(--infobox-header-fg, #f1e9d2);font-size:1.2em;text-align:center;" | {{{name|}}} | | ! colspan="2" style="background:var(--infobox-header-bg, #26272e);color:var(--infobox-header-fg, #f1e9d2);font-size:1.2em;text-align:center;" | {{{name|}}} |
| Line 80: |
Line 16: |
| {{#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 Enemy page. You normally never call it by hand: each detail page calls <code><nowiki>{{#invoke:Enemies|infobox|id=<slug>}}</nowiki></code>, and [[Module:Core]] computes the values from [[Data:Enemies.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 `|-
| |
| ! Classification
| |
| | {{#if:{{{Classification|}}}|{{{Classification}}}|—}}
| |
| |-
| |
| ! 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>Classification</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.Enemies</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> |
What this template does
Renders the infobox panel at the top right of every Enemy page. You normally never call it by hand: each detail page calls {{#invoke:Enemies|infobox|id=<slug>}}, and Module:Core computes the values from Data:Enemies.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.
icon — File: image name for the entity's icon.
Classification
Stats
If you add or remove a row here, keep Module:Core's INFOBOX_FIELD_ORDER.Enemies 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).