User:Athrash/Template

From Wikiversity
Jump to navigation Jump to search

Section 1[edit]

For each page with more than three headings, a table of contents (TOC) is automatically generated from the section headings, unless:

  • (for a user) preferences are set to turn it off
  • (for an article) the magic word __NOTOC__ (with two underscores on either side of the word) is added in the edit box

When either __FORCETOC__ or __TOC__ (with two underscores on either side of the word) is placed in the wikitext, a TOC is added even if the page has fewer than four headings.

With __FORCETOC__, the TOC is placed before the first section header. With __TOC__, it is placed at the same position where this code is placed. This allows any positioning, also e.g. on the right, and in a table cell, and it also allows multiple occurrence, e.g. in every section (demonstrated on m:Help talk:Section; however, this seems only useful if the sections are long, so that the TOCs take up only a small part of the total space.).

Thus there may be some introductory text before the TOC, known as the "lead". Although usually a header after the TOC is preferable, __TOC__ can be used to avoid being forced to insert a meaningless header just to position the TOC correctly, i.e., not too low.

Preferences can be set to number the sections automatically.

In a page calling a template with sections, the sections in the template are numbered according to their position in the rendered page, e.g. if the template tag is in the third section, then the first section of the template is numbered four. Any text in the template before its first section shows up as part of the section with the template tag, and any text after the tag before a new header shows up as part of the last section of the template. This may be done deliberately, but can usually better be avoided (see also below).

Using __NOTOC__ it's possible to disable the normal Table of Contents. Section links as explained below allow to create compact ToCs, e.g. alphabetical [[#A|A]] [[#B|B]] etc.

The Table of contents can be forced onto a floating table on the right hand of the screen with the code below

 {|align=right
  |__TOC__
  |}
New Testament

This box: viewtalkedit

Section 2[edit]

Section 3[edit]

Section 4[edit]

Section 5[edit]

Section 6[edit]

Section 7[edit]

Section 8[edit]

Section 9[edit]