Template:Category/Forum/post row/render

From Miniscope
Jump to: navigation, search

HTML renderer for one forum post row. Called from Template:Category/Forum/post_row after that template has decided whether the row should be drawn at all (announcement suppression in the regular-mode list) and resolved the Forum fallback.

Splitting render out of post_row keeps the dispatcher's #switch ladder small and means this template can be invoked directly for one-off previews ({{Category/Forum/post_row/render|Post=Forum talk:Hardware/2026-05-09T_alice|Subject=Calibration weirdness|Forum=Forum:Hardware|...}}) without going through the suppression logic.

Named params:

  • Post — full topic page title.
  • Subject — H2-derived title; falls back to the last
 /-segment of Post for hook-less legacy topics.
  • Forum — containing forum (already resolved against the
 default by post_row).
  • Starter — Topic starter page (User:Name typically).
  • Replies / People — counts.
  • LastActivity — pre-formatted localized date string.
  • pinned — non-empty if this row is an announcement;
 controls the pin marker and the .is-pinned class.

Color class derivation: is-color-{1..8} is chosen by character-code-mod-8 of the forum's bare PAGENAME first letter. X is the standard MW idiom for "first character of X" (pad an empty string to length 1 using X as the pad source, MW takes the first pad char). The result is uppercased before #switch so casing doesn't matter. Anything non-A-Z (digits, symbols, empty) falls through to is-color-0 — the neutral gray defined in styles.css.