Template:TOClimit: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(new template for only limiting the TOC, not wrapping it as with TOCfloat)
 
m (oops, copy-paste error from TOCfloat)
Line 1: Line 1:
<includeonly><div class="toclimit-{{{1|2}}}"}}>__TOC__</div></includeonly><noinclude>Sometimes the length of a table of contents (TOC) is excessive because of the number of lower-level sections (=== and below). This template allows you to remove those lower headers from the TOC. To see how this can be useful, try previewing an edit of the [[OBD:Data types]] page after removing the call to this template, and you'll see that there are a distracting number of minor subheaders which the reader doesn't need to see; he probably only will care about clicking on a major type of data, then reading about where the various subtypes are used.
<includeonly><div class="toclimit-{{{1|2}}}">__TOC__</div></includeonly><noinclude>Sometimes the length of a table of contents (TOC) is excessive because of the number of lower-level sections (=== and below). This template allows you to remove those lower headers from the TOC. To see how this can be useful, try previewing an edit of the [[OBD:Data types]] page after removing the call to this template, and you'll see that there are a distracting number of minor subheaders which the reader doesn't need to see; he probably only will care about clicking on a major type of data, then reading about where the various subtypes are used.


On the other hand, if you simply have a lot of top-level sections (==) or you feel that the lower-level sections <u>should</u> be in the TOC, then you might want to look at the [[Template:TOCfloat|TOCfloat]] template, which will cause the article text to wrap around the TOC rather than starting after the TOC. TOCfloat also offers the same limit feature as this TOClimit template, so you can can use it to both shorten the TOC and wrap text around it.
On the other hand, if you simply have a lot of top-level sections (==) or you feel that the lower-level sections <u>should</u> be in the TOC, then you might want to look at the [[Template:TOCfloat|TOCfloat]] template, which will cause the article text to wrap around the TOC rather than starting after the TOC. TOCfloat also offers the same limit feature as this TOClimit template, so you can can use it to both shorten the TOC and wrap text around it.

Revision as of 15:14, 14 July 2015

Sometimes the length of a table of contents (TOC) is excessive because of the number of lower-level sections (=== and below). This template allows you to remove those lower headers from the TOC. To see how this can be useful, try previewing an edit of the OBD:Data types page after removing the call to this template, and you'll see that there are a distracting number of minor subheaders which the reader doesn't need to see; he probably only will care about clicking on a major type of data, then reading about where the various subtypes are used.

On the other hand, if you simply have a lot of top-level sections (==) or you feel that the lower-level sections should be in the TOC, then you might want to look at the TOCfloat template, which will cause the article text to wrap around the TOC rather than starting after the TOC. TOCfloat also offers the same limit feature as this TOClimit template, so you can can use it to both shorten the TOC and wrap text around it.

It's important to have a grasp of proper wiki article layout, because this template includes the magic word __TOC__, which determines the TOC's position within the article. Thus, in order to preserve the standard layout, this means that you have to place the template markup between the lede text (if there is any) and the first subheader in the article. You are also expected to avoid the use of level 1 headers (=) when writing articles. The Zukai article demonstrates proper layout with (1) a lede that describes the project briefly without the use of a section header, followed by (2) the TOC, followed by (3) the article's body with subheaders.

Usage:

  • "{{TOClimit|3}}" would limit the TOC to displaying level 2 and 3 headers (== and ===).
  • "{{TOClimit}}" will fall back to the default setting of "2", displaying only level 2 headers (==).