Template:TopicBiblioRow: Difference between revisions
(VSCode edit) |
(Optional SchoolTib in the meta line (only CommentaryRow passes it)) |
||
| (14 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly><div class="topic-biblio-row filterable" data-class="{{{ Class | }}}"><!-- | <includeonly><div class="topic-biblio-row filterable{{#ifeq:{{{#userparam|}}}|title| topic-biblio-row--titled|}}" data-class="{{{ Class | }}}"><!-- | ||
One bibliographic entry on a topic page. | One bibliographic entry on a topic page. | ||
| Line 15: | Line 15: | ||
inline, matching the Listening Room. The audio is found by reverse lookup on | inline, matching the Listening Room. The audio is found by reverse lookup on | ||
AssociatedArticle, so nothing needs storing on the article itself. | AssociatedArticle, so nothing needs storing on the article itself. | ||
The cover is requested at 250px, which is larger than the 42px slot it sits | |||
in while collapsed. That is deliberate — opening the description grows the | |||
cover to 120px, and on a 2x display that needs 240px of real pixels. Without | |||
an explicit size MediaWiki would serve the original file instead, which on a | |||
long list means megabytes of images scaled down by the browser. | |||
250 rather than a round 260: the Commons scaler fails for exactly the 260px | |||
bucket on a subset of files (20 of 298 covers, deterministic on retry) and | |||
returns no thumbnail, so the image degrades to a plain link to the file | |||
page. Every other width tested from 100 to 500 works, 250 and 270 included. | |||
If covers ever render as links again, probe a few widths before suspecting | |||
the file, the ForeignFileRepo, or this template. | |||
The cover deliberately has no link= parameter, so its anchor points at the | |||
file page with class="image". That is the hook MultimediaViewer binds to; | |||
pointing link= at the item page suppresses the viewer, because MMV only | |||
upgrades images that link to their own file description page. The citation | |||
beside it already links to the item, so no navigation is lost. | |||
-->{{#if: {{{ FrontCoverImg | }}} | -->{{#if: {{{ FrontCoverImg | }}} | ||
|<div class="topic-biblio-thumb">[[File:{{PAGENAME:{{{ FrontCoverImg | }}}}}| | |<div class="topic-biblio-thumb tws-lightbox">[[File:{{PAGENAME:{{{ FrontCoverImg | }}}}}|200px|class=object-fit-cover w-100 h-100]]</div> | ||
|<div class="topic-biblio-thumb topic-biblio-thumb-empty"></div> | |<div class="topic-biblio-thumb topic-biblio-thumb-empty"></div> | ||
}} | }} | ||
<div class="topic-biblio-body"> | <div class="topic-biblio-body"><!-- | ||
<div class="topic-biblio-citation">[[{{{ 1 | }}}|{{#if: {{{ Citation | }}} | TITLE LINE (library hub pages only) | ||
|{{#if: {{{ Title | }}}|{{{ Title | }}}|{{SUBPAGENAME:{{{ 1 | }}}}}}} | Module:LibraryRows passes userparam=title, so its rows lead with the work's | ||
}}]]</div> | title, larger, above the citation: a list sorted by citation reads author | ||
first, and the title line keeps it scannable by work. Topic pages and the | |||
Bibliography pass nothing and are unchanged. The userparam arrives as a | |||
parameter named #userparam, with the hash. | |||
-->{{#ifeq:{{{#userparam|}}}|title | |||
|<div class="topic-biblio-title">[[{{{ 1 | }}}|{{#if: {{{ FullTitleTib | }}} | |||
|{{I18n|en={{#if: {{{ Title | }}}|{{{ Title | }}}|{{SUBPAGENAME:{{{ 1 | }}}}}}}|bo={{{ FullTitleTib | }}}}} | |||
|{{#if: {{{ Title | }}}|{{{ Title | }}}|{{SUBPAGENAME:{{{ 1 | }}}}}}} | |||
}}]]</div> | |||
| | |||
}} | |||
<div class="topic-biblio-citation">[[{{{ 1 | }}}|{{#if: {{{ FullTitleTib | }}} | |||
|{{#ifeq:{{{#userparam|}}}|title | |||
|{{#if: {{{ Citation | }}}|{{{ Citation | }}}|{{#if: {{{ Title | }}}|{{{ Title | }}}|{{SUBPAGENAME:{{{ 1 | }}}}}}}}} | |||
|{{I18n|en={{#if: {{{ Citation | }}}|{{{ Citation | }}}|{{#if: {{{ Title | }}}|{{{ Title | }}}|{{SUBPAGENAME:{{{ 1 | }}}}}}}}}|bo={{{ FullTitleTib | }}}}} | |||
}} | |||
|{{#if: {{{ Citation | }}}|{{{ Citation | }}}|{{#if: {{{ Title | }}}|{{{ Title | }}}|{{SUBPAGENAME:{{{ 1 | }}}}}}}}} | |||
}}]]<!-- | |||
TIBETAN (the language toggle) | |||
FullTitleTib and DescriptionTib, where the item has them, are carried as the | |||
Tibetan side of {{I18n}}, so switching the toggle to Tibetan shows them and an | |||
item without them stays in English. On a titled row the Tibetan title goes on | |||
the title line and the citation stays as it is, so the title is not shown twice. | |||
--><!-- | |||
AUTHOR BYLINE | |||
Inline, straight after the title, so the line reads the way a citation does | |||
— work then author — rather than stacking a second line under it. | |||
Only when there is no Citation: a citation already opens with the author, so | |||
printing it again would just repeat the line above. Our own editorial writing | |||
carries no citation at all, which is what left those rows with no attribution. | |||
BcaAuthor arrives as a raw page title ("People/Houlton, S."), because the | |||
query runs with link=none and would otherwise flatten it to plain text. The | |||
link is built here instead, and MediaWiki applies the person's display title, | |||
so it reads "Simon Houlton". | |||
Deliberately NOT split with #arraymap: these page names contain commas, so | |||
splitting on comma turns one author into two red links. | |||
Present on about a quarter of Editorial pages, so the row still has to read | |||
correctly without it. No leading space before the span: it is supplied in CSS | |||
so the separator moves with the styling. | |||
-->{{#if: {{{ Citation | }}} | |||
| | |||
|{{#if: {{{ BcaAuthor | }}} | |||
|<span class="topic-biblio-byline">[[{{{ BcaAuthor | }}}]]</span> | |||
| | |||
}} | |||
}}</div> | |||
<div class="topic-biblio-meta">{{#if: {{{ Class | }}} | <div class="topic-biblio-meta">{{#if: {{{ Class | }}} | ||
|<span class="topic-biblio-class">{{{ Class | }}}</span> | |<span class="topic-biblio-class">{{{ Class | }}}</span> | ||
| | |||
}}{{#if: {{{ SchoolTib | }}} | |||
|<span class="topic-biblio-school" lang="bo">{{#arraymap:{{{ SchoolTib | }}}|;|@@@|@@@| · }}</span> | |||
| | | | ||
}}{{#if: {{{ Pubdate | }}} | }}{{#if: {{{ Pubdate | }}} | ||
|<span class="topic-biblio-date">{{{ Pubdate | }}}</span> | |<span class="topic-biblio-date">{{{ Pubdate | }}}</span> | ||
| | | | ||
}}{{#if: {{{ TileDescription | }}}{{{ Description | }}} | }}{{#if: {{{ TileDescription | }}}{{{ Description | }}}{{{ DescriptionTib | }}} | ||
|<span class="topic-biblio-more" role="button" tabindex="0" aria-expanded="false">About this item</span> | |<span class="topic-biblio-more" role="button" tabindex="0" aria-expanded="false">About this item</span> | ||
| | | | ||
}} | }} | ||
</div>{{#if: {{{ TileDescription | }}}{{{ Description | }}} | </div>{{#if: {{{ TileDescription | }}}{{{ Description | }}}{{{ DescriptionTib | }}} | ||
|<div class="topic-biblio-desc" hidden>{{#if: {{{ | |<div class="topic-biblio-desc" hidden>{{#if: {{{ DescriptionTib | }}} | ||
|{{{ TileDescription | }}} | |{{I18n|en={{#if: {{{ TileDescription | }}}|{{{ TileDescription | }}}|{{#if: {{{ Description | }}}|{{{ Description | }}}|{{{ DescriptionTib | }}}}}}}|bo={{{ DescriptionTib | }}}}} | ||
|{{{ Description | }}} | |{{#if: {{{ TileDescription | }}}|{{{ TileDescription | }}}|{{{ Description | }}}}} | ||
}}</div> | }}</div> | ||
|}} | |}} | ||
Latest revision as of 12:20, 5 October 2026
Renders one row of the bibliographic list on a topic page.
Called by Template:TopicBiblioSection with named args=yes, so the
printout names in that query must match the parameter names used here.