Template:UI/faqs library/entry
Row partial for Template:UI/faqs_library. Called by the
library's format=filtered ask in positional mode — args
come in the order printouts are declared on the #ask
call (SRF's filtered list view doesn't shuffle filtered columns to
the front).
Positional args:
{{{1}}}— page name (frommainlabel=page){{{2}}}— Has question{{{3}}}— Has answer{{{4}}}— Has guide topic (sidebar facet + row chip){{{5}}}— Has workflow stage (sidebar facet + row chip){{{6}}}— Has audience level (sidebar facet + row chip){{{7}}}— Has project (sidebar facet only; not rendered){{{8}}}— Has guide (expanded-area "in-depth" link)
Renders a collapsible row: the question is always visible (linked
to the FAQ page); the answer body and "in-depth" link expand
inline when the user toggles the row. Toggle text is customized
to chevrons (▸ Show answer / ▾ Hide answer)
via data-expandtext / data-collapsetext —
both are sanitizer-allowed (data-* attrs survive the
wikitext Sanitizer except for the reserved
data-ooui, data-mw, data-parsoid
prefixes).
Why mw-collapsible instead of HTML5 <details>:
MediaWiki's Sanitizer doesn't whitelist <details> /
<summary> as of the targeted MW version, so they'd
be stripped. mw-collapsible is the established collapse
idiom in this repo (see Category:Review record/State's
history block).
Why this is safe inside SRF's filtered format:
format=filtered renders all rows server-side at
#ask expansion time and the client-side filter JS
hides/shows pre-rendered rows; it doesn't re-render or replace DOM
nodes. So MW's mediawiki.page.ready initialization of
.mw-collapsible binds correctly to every row at page
load, and toggles keep working when the visible row set changes.
Why positional, not named
Mirrors Template:UI/publications_library/entry — SRF's filtered
list view, with list view named args=yes, prefixes
param names with a literal ?; positional is the
cleaner workaround. See the library template's noinclude for the
full reasoning.
The empty-answer case ( blank) is intentionally shown as
"View full answer on page →" — some FAQs put their answer in the
page body (free-form wikitext) rather than the Has answer
property. The expand still works; it just sends the user to the
FAQ page for the body.