Template:LibraryItem: Difference between revisions

From Bodhicitta
(Defer the citations panel so it does not slow the page parse)
(Citations panel: gate on an actual QuoteSource count instead of the RKTS DrlPageName prefix, which hid 16 cited texts without a catalogue number)
Line 282: Line 282:
CITED IN THE ŚIKṢĀSAMUCCAYA
CITED IN THE ŚIKṢĀSAMUCCAYA


Renders only when this text is actually quoted in the SSC. The gate is the
Renders only when this page is actually quoted: at least one segment's
data itself: Module:SscCitations returns nothing unless the page carries a
QuoteSource names it. QuoteSource is a Page-type property, so the count is one
DrlPageName (an RKTS catalogue id, only set on canonical texts) that appears
cheap indexed lookup, and SMW resolves redirects on a page value, so a segment
in a QuoteSource on an SSC segment. No flag to maintain, and no list to keep
that named one of the text's other titles counts too. No flag to maintain, and
in sync as the alignment grows.
no list to keep in sync as the alignments grow.


The count is of QUOTATIONS, not segments. One quotation is often split over
The count is of QUOTATIONS, not segments. One quotation is often split over
Line 297: Line 297:
Laṅkāvatārasūtra by six. The panel groups by citing work, root texts first.
Laṅkāvatārasūtra by six. The panel groups by citing work, root texts first.


Collapsed by default, and the panel itself is @deferred: the module reads
Collapsed by default, and the panel itself is @deferred so the module runs
every quote segment on the wiki, which takes seconds, so it runs after the
after the page paints. See Template:SscCitationsDeferred.
page paints rather than inside the parse. See Template:SscCitationsDeferred.


The gate is now DrlPageName rather than a count, because asking for a count
This gate used to test DrlPageName for an "RKTS" catalogue prefix, a proxy for
would run the module during the parse and undo the deferral. Read with #show,
"canonical text" from before QuoteSource was a Page. It hid every cited text
not GetItemData — that helper does not carry this property.
without a catalogue number (16 in Oct 2026, e.g. Tathāgatakośasūtra). The
module still checks Classification, so a non-text page that is named as a
source renders no passages, and tws.js removes the empty panel.


Tested for the "RKTS" prefix, not merely for being set: every library item
Keep the pipe on the same line as the expression: #ifexpr fails on a trailing
has a DrlPageName, but on a modern book it is the title ("The Intelligent
newline.
Heart"). Only a catalogue number can match a QuoteSource.
-->{{#ifexpr: {{#ask:[[QuoteSource::{{FULLPAGENAME}}]]|format=count}} > 0|
 
<div class="ssc-citations-block mw-collapsible mw-collapsed" data-expandtext="Show the passages" data-collapsetext="Hide the passages">
Any canonical text has the property, so the panel renders on 256 pages while
only 112 are cited. tws.js removes it once the deferred block lands empty.
-->{{#ifeq: {{#sub:{{#show:{{FULLPAGENAME}}|?DrlPageName}}|0|4}}|RKTS
|<div class="ssc-citations-block mw-collapsible mw-collapsed" data-expandtext="Show the passages" data-collapsetext="Hide the passages">
<div class="ssc-citations-heading"><i class="fa-sharp-duotone fa-solid fa-quote-left fa-sm mr-2"></i>Quoted in the aligned translations</div>
<div class="ssc-citations-heading"><i class="fa-sharp-duotone fa-solid fa-quote-left fa-sm mr-2"></i>Quoted in the aligned translations</div>
<div class="mw-collapsible-content">{{#ask:[[{{FULLPAGENAME}}]]
<div class="mw-collapsible-content">{{#ask:[[{{FULLPAGENAME}}]]

Revision as of 13:04, 1 October 2026