Template:Firehose row: Difference between revisions
Point guest linking at Module:Firehose links (via update-page on MediaWiki MCP Server) |
Show episode artwork at the start of each row (pickipedia #117) (via update-page on MediaWiki MCP Server) |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 8: | Line 8: | ||
# page title of the episode | # page title of the episode | ||
# Has podcast | # Has podcast | ||
# Has | # Has topic | ||
# Has air date | # Has air date | ||
# Has episode url | # Has episode url | ||
# Has duration, in seconds | |||
# Has audio url | |||
# Has image url | |||
An episode's subjects are split into '''people''' and '''topics''' by | |||
[[Module:Firehose links]]: a page in [[:Category:People]] is a person, any other | |||
existing page — a band, a festival, a tune — is a topic, and a name with no page | |||
yet is filed with the people, since that is nearly always what the title parser | |||
has found. Writing the page corrects it. | |||
The query runs with <code>link=none</code>, so every value arrives as plain | The query runs with <code>link=none</code>, so every value arrives as plain | ||
text. That is deliberate: Semantic MediaWiki otherwise hands over pre-rendered | text. That is deliberate: Semantic MediaWiki otherwise hands over pre-rendered | ||
links, which defeats <code>#titleparts</code> and makes the episode link | links, which defeats <code>#titleparts</code> and makes the episode link | ||
impossible to relabel. | impossible to relabel. | ||
Note that <code>#expr</code> takes <code>round</code> as an infix operator — | |||
<code>x / 60 round 0</code>, never <code>round(x / 60, 0)</code>. The function | |||
form parses but fails at render time with "Unexpected round operator", which is | |||
the sort of error you only see if you look at the page. | |||
Laid out with divs rather than table markup on purpose: this template's output | Laid out with divs rather than table markup on purpose: this template's output | ||
| Line 27: | Line 39: | ||
encoded slash before MediaWiki sees it — so a subpage here would be a template | encoded slash before MediaWiki sees it — so a subpage here would be a template | ||
no bot could ever fix. | no bot could ever fix. | ||
The separators are written <code>&#32;&middot;</code> rather than with a | |||
literal leading space. <code>#if</code> trims whitespace from both ends of its | |||
branches, so a plain space before the dot is thrown away — the date ran into it | |||
("March 10, 2025· 59 min"), and a row with audio but no episode page started | |||
with a stray dot. | |||
The artwork is the bare image URL, which MediaWiki renders as a picture at | |||
whatever size the publisher made it — often 1400 pixels square. The | |||
<code>pp-episode-art</code> rule in [[MediaWiki:Common.css]] shrinks it to a | |||
thumbnail. An episode with no artwork gets an empty square of the same size, so | |||
the titles still line up. | |||
[[Category:Templates]] | [[Category:Templates]] | ||
</noinclude><includeonly><div style="display:flex; align-items: | </noinclude><includeonly><div style="display:flex; align-items:center; gap:.8em; padding:.55em .2em; border-bottom:1px solid #d4dacd;"> | ||
{{#if:{{{8|}}}|<div class="pp-episode-art pp-episode-art--row">{{{8}}}</div>|<div class="pp-episode-art pp-episode-art--row pp-episode-art--none"></div>}} | |||
<div style="flex:1 1 auto; min-width:0;"> | <div style="flex:1 1 auto; min-width:0;"> | ||
<div style="font-size:.72em; letter-spacing:.09em; text-transform:uppercase; color:#5a6858;">{{#if:{{{2|}}}|[[{{{2}}}]]|}}</div> | <div style="font-size:.72em; letter-spacing:.09em; text-transform:uppercase; color:#5a6858;">{{#if:{{{2|}}}|[[{{{2}}}]]|}}</div> | ||
<div style="font-weight:600; line-height:1.35;">[[{{{1}}}|{{#titleparts:{{{1}}}|0|2}}]]</div> | <div style="font-weight:600; line-height:1.35;">[[{{{1}}}|{{#titleparts:{{{1}}}|0|2}}]]</div> | ||
{{#if:{{{3|}}}|<div style="font-size:.85em; color:#3d4a3e;"> | {{#if:{{{3|}}}|<div style="font-size:.85em; color:#3d4a3e;">{{#invoke:Firehose links|subjects|{{{3}}}}}</div>}} | ||
</div> | |||
<div style="flex:0 0 auto; text-align:right; font-family:monospace; font-size:.78em; color:#6b7566; white-space:nowrap;"> | |||
<div>{{{4|}}}{{#if:{{{6|}}}| · {{#expr: {{{6}}} / 60 round 0}} min}}</div> | |||
<div>{{#if:{{{5|}}}|[{{{5}}} episode]{{#if:{{{7|}}}| · }}}}{{#if:{{{7|}}}|[{{{7}}} audio]}}</div> | |||
</div> | </div> | ||
</div></includeonly> | </div></includeonly> | ||
Latest revision as of 00:05, 15 September 2026
Renders one episode row for Template:Firehose. Not intended to be called
directly — it is passed to #ask as template=Firehose row.
Parameters arrive positionally, in the order the printouts are declared in Template:Firehose:
- page title of the episode
- Has podcast
- Has topic
- Has air date
- Has episode url
- Has duration, in seconds
- Has audio url
- Has image url
An episode's subjects are split into people and topics by Module:Firehose links: a page in Category:People is a person, any other existing page — a band, a festival, a tune — is a topic, and a name with no page yet is filed with the people, since that is nearly always what the title parser has found. Writing the page corrects it.
The query runs with link=none, so every value arrives as plain
text. That is deliberate: Semantic MediaWiki otherwise hands over pre-rendered
links, which defeats #titleparts and makes the episode link
impossible to relabel.
Note that #expr takes round as an infix operator —
x / 60 round 0, never round(x / 60, 0). The function
form parses but fails at render time with "Unexpected round operator", which is
the sort of error you only see if you look at the page.
Laid out with divs rather than table markup on purpose: this template's output is assembled inside a parser function call, and pipe characters in that position are a reliable source of grief.
The name has no slash in it deliberately. Pages with a slash in the title cannot currently be read or edited through the REST API, because Apache rejects the encoded slash before MediaWiki sees it — so a subpage here would be a template no bot could ever fix.
The separators are written  · rather than with a
literal leading space. #if trims whitespace from both ends of its
branches, so a plain space before the dot is thrown away — the date ran into it
("March 10, 2025· 59 min"), and a row with audio but no episode page started
with a stray dot.
The artwork is the bare image URL, which MediaWiki renders as a picture at
whatever size the publisher made it — often 1400 pixels square. The
pp-episode-art rule in MediaWiki:Common.css shrinks it to a
thumbnail. An episode with no artwork gets an empty square of the same size, so
the titles still line up.