Template:TOCright: Difference between revisions
Jump to navigation
Jump to search
(enable TOC header level limits and non numbering.) |
(update with optional indentation level and no-numbering parameters) |
||
Line 1: | Line 1: | ||
<noinclude>{{TOCright|num=nonumtoc|clear=left}} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
|__TOC__ |
|__TOC__ |
||
|}<noinclude> |
|}<noinclude> |
||
⚫ | |||
==Table of Contents - right== |
==Table of Contents (TOC) - right== |
||
⚫ | This template can be used to wrap page text around a right-side table of contents box and, optionally, limit the depth of priority levels, and eliminate the heading numbering. An alternate template, [[Template:TOCleft]], is available if one wants to place the table of contents box on the left side of the page. |
||
===Common usage=== |
|||
⚫ | |||
==TOC indentation== |
|||
* The first heading in sequence position entered on a page will always appear in the table of contents first in order and at the left-most indentation, even if a secondary or lower priority ranking is entered for the heading by means of the paired sets of equal signs to the left and right of the heading title. |
|||
* The article page title is automatically given the =H1= style and displayed above the body of the page, but the title never appears in the table of contents. |
|||
*: (The Wikipedia [[wikipedia:Wikipedia:Manual_of_Style#Section_headings|Manual of Style]] and the [[OLPC:Style_guide#Headers|OLPC Style guide]] reserves =H1= for the top level article title, so ==H2== headings should be the primary priority headings in the page content.) |
|||
* In the table of contents, the heading indents will only step to the right one level at a time—never skipping a level. |
|||
*: In the page content, if a heading is entered that is more than one level lower in priority than the previous heading level, the table of contents will treat the next (in page position), lower-priority heading as an H(n+1) heading, where n was the level of the previous higher-priority heading. (See the examples below.) |
|||
* If an =H1= level heading is entered in the page content, it will appear in the table of contents at the indent level of the preceding heading. |
|||
===Special usage=== |
|||
* <code><nowiki>{{TOCright|limit=1}}</nowiki></code> (range: [<tt>1</tt>–<tt>5</tt>], anything else has no effect) - Limits the depth of indentation shown in the table of contents headings only. |
|||
*: For instance, using <tt>limit=1</tt> will show only the highest priority headings used on the page excluding the headings that would be indented 1 or more levels, <tt>limit=2</tt> will exclude the headings indented 2 or more levels in the table of contents, according to the indentation rules above. |
|||
*:: (Headings with low priority encodings, like <tt>=====H5=====</tt> may appear at shallow indentations if are entered on the page above higher priority headings. (The styles of the headings as presented in the page body are unaffected by the table of contents logic.) |
|||
⚫ | |||
<!-- |
|||
* <code><nowiki>{{TOCright|clear=left}}</nowiki></code> (options: <tt>left, '''right''', both, none</tt>, default: '''<tt>right</tt>''') - Sets the CSS property to force the page content to clear on the named side of the table of contents box. --> |
|||
====Heading hierarchy example==== |
|||
=====H5===== |
|||
:The above heading results when |
|||
<tt>=====H5=====</tt> |
|||
: is entered. |
|||
=H1= |
|||
:... |
|||
<tt>=H1=</tt> |
|||
* This template can be used to wrap page text around a right-side table of contents box. |
|||
: entered. |
|||
⚫ | |||
==H2== |
|||
*: <code><nowiki>{{TOCright|limit=3}}</nowiki></code> Limits the depth of subheadings shown. For instance, using limit=2 will show only the =h1= and ==h2== header titles. (For the table of contents, the first header on the page will take on the level of the second header if they are different.) |
|||
<tt>==H2==</tt> |
|||
⚫ | |||
===H3=== |
|||
⚫ | |||
<tt>===H3===</tt> |
|||
====H4==== |
|||
<tt>====H4====</tt> |
|||
=H1= |
|||
<tt>=H1=</tt> |
|||
=====h5===== |
|||
<tt>=====H5=====</tt> |
|||
==H2== |
|||
<tt>==H2==</tt> |
|||
======H6====== |
|||
<tt>======H6======</tt> |
|||
=======H7======= |
|||
<tt>=======H7=======</tt> |
|||
========H8======== |
|||
<tt>========H8========</tt> |
|||
</noinclude> |
</noinclude> |
Revision as of 11:06, 11 November 2009
Table of Contents (TOC) - right
This template can be used to wrap page text around a right-side table of contents box and, optionally, limit the depth of priority levels, and eliminate the heading numbering. An alternate template, Template:TOCleft, is available if one wants to place the table of contents box on the left side of the page.
Common usage
{{TOCright}}
- Entered on the page where you want the table of contents box to appear.
TOC indentation
- The first heading in sequence position entered on a page will always appear in the table of contents first in order and at the left-most indentation, even if a secondary or lower priority ranking is entered for the heading by means of the paired sets of equal signs to the left and right of the heading title.
- The article page title is automatically given the =H1= style and displayed above the body of the page, but the title never appears in the table of contents.
- (The Wikipedia Manual of Style and the OLPC Style guide reserves =H1= for the top level article title, so ==H2== headings should be the primary priority headings in the page content.)
- In the table of contents, the heading indents will only step to the right one level at a time—never skipping a level.
- In the page content, if a heading is entered that is more than one level lower in priority than the previous heading level, the table of contents will treat the next (in page position), lower-priority heading as an H(n+1) heading, where n was the level of the previous higher-priority heading. (See the examples below.)
- If an =H1= level heading is entered in the page content, it will appear in the table of contents at the indent level of the preceding heading.
Special usage
{{TOCright|limit=1}}
(range: [1–5], anything else has no effect) - Limits the depth of indentation shown in the table of contents headings only.- For instance, using limit=1 will show only the highest priority headings used on the page excluding the headings that would be indented 1 or more levels, limit=2 will exclude the headings indented 2 or more levels in the table of contents, according to the indentation rules above.
- (Headings with low priority encodings, like =====H5===== may appear at shallow indentations if are entered on the page above higher priority headings. (The styles of the headings as presented in the page body are unaffected by the table of contents logic.)
- For instance, using limit=1 will show only the highest priority headings used on the page excluding the headings that would be indented 1 or more levels, limit=2 will exclude the headings indented 2 or more levels in the table of contents, according to the indentation rules above.
{{TOCright|num=nonumtoc}}
Removes the numbers preceding the section heading titles. The limit and num parameters are implemented through CSS classes in the MediaWiki:Common.css.
Heading hierarchy example
H5
- The above heading results when
=====H5=====
- is entered.
H1
- ...
=H1=
- entered.
H2
==H2==
H3
===H3===
H4
====H4====
H1
=H1=
h5
=====H5=====
H2
==H2==
H6
======H6======
=H7=
=======H7=======
==H8==
========H8========