Jump to content

Template:Adhyaya: Difference between revisions

From Grantha
No edit summary
No edit summary
Line 4: Line 4:
| chapter_num  = String
| chapter_num  = String
| title        = String
| title        = String
| title_trans  = String
| has_intro    = Boolean
}}</noinclude>{{#cargo_store: _table=Adhyaya
}}</noinclude>{{#cargo_store: _table=Adhyaya
| document_id  = {{{document_id|}}}
| document_id  = {{{document_id|}}}
Line 11: Line 9:
| chapter_num  = {{{chapter_num|}}}
| chapter_num  = {{{chapter_num|}}}
| title        = {{{title|}}}
| title        = {{{title|}}}
| title_trans  = {{{title_trans|}}}
}}<includeonly><div class="adhyaya-block" id="{{{document_id|}}}_C{{{chapter_num|}}}"><h2><span class="mw-headline" id="{{{document_id|}}}_C{{{chapter_num|}}}">{{{title|}}}</span></h2></div></includeonly><noinclude>
| has_intro    = {{#if:{{{intro|}}}|yes|no}}
}}<includeonly>{{#if:{{{title_trans|}}}|<p class="adhyaya-trans">{{{title_trans}}}</p>}}{{#if:{{{intro|}}}|<div class="adhyaya-intro">{{{intro}}}</div>}}</includeonly><noinclude>
== Template:Adhyaya ==
== Template:Adhyaya ==
Stores chapter/section metadata in Cargo. The heading itself is rendered
Stores chapter metadata in Cargo and renders the adhyaya heading.
by the <code>== heading ==</code> wiki markup before this template call,
 
so MediaWiki's built-in TOC picks it up automatically.
The h2 with mw-headline span is picked up by MediaWiki's TOC generator
automatically — the built-in TOC lists all adhyayas without needing
== wiki headings == in the page source.
 
The id= on both the outer div and the inner span uses the document's
chapter id (e.g. BGB_C01) so anchor links like #BGB_C01 work directly.


=== Parameters ===
=== Parameters ===
Line 24: Line 25:
! Parameter !! Description
! Parameter !! Description
|-
|-
| <code>document_id</code> || Document ID (e.g. IS, AIT)
| document_id || Document ID (e.g. BGB, BS, NNS)
|-
| <code>chapter_num</code> || Chapter number (1, 2, 3…)
|-
| <code>title</code> || Section/chapter title in Sanskrit
|-
|-
| <code>title_trans</code> || Optional transliteration
| chapter_num || Chapter number (1, 2, 3...)
|-
|-
| <code>intro</code> || Optional introductory text
| title || Chapter/section title in Sanskrit
|}
|}
[[Category:Templates]]
[[Category:Templates]]
[[Category:Cargo store templates]]
[[Category:Cargo store templates]]
</noinclude>
</noinclude>

Revision as of 06:38, 13 April 2026

This template defines the table "Adhyaya". View table. A replacement table has been generated for this table; View replacement table.

Template:Adhyaya

Stores chapter metadata in Cargo and renders the adhyaya heading.

The h2 with mw-headline span is picked up by MediaWiki's TOC generator automatically — the built-in TOC lists all adhyayas without needing == wiki headings == in the page source.

The id= on both the outer div and the inner span uses the document's chapter id (e.g. BGB_C01) so anchor links like #BGB_C01 work directly.

Parameters

Parameter Description
document_id Document ID (e.g. BGB, BS, NNS)
chapter_num Chapter number (1, 2, 3...)
title Chapter/section title in Sanskrit