Jump to content

Template:Adhyaya: Difference between revisions

From Grantha
Created page with "<!-- Template:Adhyaya/doc --> == Usage == Renders a chapter heading with optional collapsible introduction. Auto-generates a stable anchor ID (<code>{document_id}_C{chapter_num}</code>) for cross-referencing. === Example === <pre> {{Adhyaya | document_id = NNS | chapter_num = 01 | title = प्रथमोऽध्यायः | title_trans = Prathamō'dhyāyaḥ | intro = This chapter discusses the luminosity of the Lord's nails. }} </pre> === Linkin..."
 
No edit summary
Line 1: Line 1:
<!-- Template:Adhyaya/doc -->
<!--
== Usage ==
  Template:Adhyaya
Renders a chapter heading with optional collapsible introduction.
  ════════════════
Auto-generates a stable anchor ID (<code>{document_id}_C{chapter_num}</code>) for cross-referencing.
  Renders a chapter heading with optional intro text.
  Auto-generates a stable HTML anchor ID for cross-referencing.


=== Example ===
  Parameters:
<pre>
    document_id   – e.g. NNS             (required)
{{Adhyaya
    chapter_num   – e.g. 01             (required, zero-padded)
| document_id = NNS
    title        – Sanskrit/display title (required)
| chapter_num = 01
    title_trans   – IAST transliteration (optional)
| title       = प्रथमोऽध्यायः
    intro         – Introductory prose    (optional)
| title_trans  = Prathamō'dhyāyaḥ
| intro       = This chapter discusses the luminosity of the Lord's nails.
}}
</pre>


=== Linking to a chapter ===
  Auto-ID format: {document_id}_C{chapter_num}
Use <code>[[PageName#{document_id}_C{chapter_num}]]</code> anywhere on the wiki.
  Example:        NNS_C01


Example: <code>[[Nakha#NNS_C01]]</code>
  Usage:
    {{Adhyaya
    | document_id  = NNS
    | chapter_num  = 01
    | title        = प्रथमोऽध्यायः
    | title_trans  = Prathamō'dhyāyaḥ
    | intro        = This chapter deals with...
    }}
-->
<div
  class="adhyaya-block"
  id="{{{document_id}}}_C{{{chapter_num}}}"
  style="margin:2em 0 1.5em;font-family:'Adishila',serif;">


=== Parameters ===
  <!-- Chapter heading bar -->
{| class="wikitable"
  <div class="adhyaya-heading" style="
! Parameter !! Required !! Description
    border-bottom: 2px solid #8b6914;
|-
    padding-bottom: 6px;
| <code>document_id</code> || Yes || Short document code, e.g. <code>NNS</code>
    margin-bottom: 0.6em;">
|-
| <code>chapter_num</code> || Yes || Zero-padded chapter number, e.g. <code>01</code>
|-
| <code>title</code> || Yes || Chapter title in Sanskrit / Kannada
|-
| <code>title_trans</code> || No || IAST transliteration of the title
|-
| <code>intro</code> || No || Introductory prose (shown collapsible)
|}


=== Auto-ID format ===
    <span class="adhyaya-num" style="
<code>{document_id}_C{chapter_num}</code> → e.g. <code>NNS_C01</code>
      display:inline-block;
      font-size:0.78em;
      font-weight:bold;
      color:#fff;
      background:#8b6914;
      padding:2px 9px;
      border-radius:3px;
      margin-right:10px;
      vertical-align:middle;
      letter-spacing:0.04em;">
      Chapter {{{chapter_num}}}
    </span>


=== Cargo table ===
    <span class="adhyaya-title" style="
Stores to table <code>Adhyaya</code>. To initialise the table, run:
      font-size:1.45em;
<code>Special:CargoTables</code> → Recreate table for <code>Adhyaya</code>.
      font-weight:bold;
      color:#2a1f0a;
      vertical-align:middle;">
      {{{title}}}
    </span>


== Cargo table declaration ==
    {{#if:{{{title_trans|}}}|
<!-- Place this ONCE on Template:Adhyaya itself, inside a noinclude block -->
    <span class="adhyaya-title-trans" style="
<noinclude>
      display:block;
{{#cargo_declare: _table=Adhyaya
      font-size:0.88em;
| document_id  = String
      color:#7a6030;
| chapter_id  = String
      font-style:italic;
| chapter_num  = String
      margin-top:2px;
| title        = String
      margin-left:2px;">
| title_trans = String
      {{{title_trans}}}
| has_intro    = Boolean
    </span>
}}
    }}
</noinclude>


<includeonly>[[Category:Chapter templates]]</includeonly>
    <!-- Cross-reference permalink -->
    <a
      href="#{{{document_id}}}_C{{{chapter_num}}}"
      class="adhyaya-anchor"
      title="Link to this chapter: {{{document_id}}}_C{{{chapter_num}}}"
      style="
        display:inline-block;
        margin-left:10px;
        font-size:0.72em;
        color:#c9a84c;
        text-decoration:none;
        vertical-align:middle;
        opacity:0.7;">
      ¶ {{{document_id}}}_C{{{chapter_num}}}
    </a>
  </div>
 
  <!-- Intro block (collapsible if present) -->
  {{#if:{{{intro|}}}|
  <div class="adhyaya-intro mw-collapsible" style="
    background:#f8f3e8;
    border:1px solid #d4b866;
    border-left:4px solid #8b6914;
    border-radius:0 4px 4px 0;
    padding:10px 14px;
    margin-top:0.5em;
    font-family:'Adishila',serif;
    font-size:1em;
    line-height:1.9;
    color:#2a1f0a;">
 
    <div class="mw-collapsible-toggle adhyaya-intro-header" style="
      font-size:0.78em;
      font-weight:bold;
      color:#8b6914;
      text-transform:uppercase;
      letter-spacing:0.07em;
      margin-bottom:6px;
      cursor:pointer;">
      ▶ Introduction
    </div>
 
    <div class="mw-collapsible-content adhyaya-intro-body" style="
      direction:auto;
      unicode-bidi:plaintext;">
      {{{intro}}}
    </div>
 
  </div>
  }}
 
</div>
<!-- Cargo store for chapter index -->
{{#cargo_store: _table=Adhyaya
| document_id  = {{{document_id|}}}
| chapter_id  = {{{document_id}}}_C{{{chapter_num}}}
| chapter_num  = {{{chapter_num|}}}
| title        = {{{title|}}}
| title_trans  = {{{title_trans|}}}
| has_intro    = {{#if:{{{intro|}}}|yes|no}}
}}<!--store only-->

Revision as of 07:14, 10 March 2026

   
     Chapter {{{chapter_num}}}
   
   
     {{{title}}}
   


   <a
     href="#{{{document_id}}}_C{{{chapter_num}}}"
     class="adhyaya-anchor"
     title="Link to this chapter: {{{document_id}}}_C{{{chapter_num}}}"
     style="
       display:inline-block;
       margin-left:10px;
       font-size:0.72em;
       color:#c9a84c;
       text-decoration:none;
       vertical-align:middle;
       opacity:0.7;">
     ¶ {{{document_id}}}_C{{{chapter_num}}}
   </a>