Difference between revisions of "Template:TOCright"
Jump to navigation
Jump to search
(rework with show toclevel parameter, non-numbered headings option (works in monobook skin, but not currently in shikiwiki)) |
(update for nonum TOC default) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <noinclude>{{TOCright | + | <noinclude>{{TOCright}} |
[[Category:TOC templates|{{PAGENAME}}]] | [[Category:TOC templates|{{PAGENAME}}]] | ||
</noinclude>{| cellspacing="0" cellpadding="0" style="clear: {{{clear|right}}}; margin-bottom: .5em; float: right; padding: .5em 0 .8em 1.4em; background: none; width: {{{1|auto}}};" class="toclimit-{{#expr: 1 + {{{show|11}}} }} {{{num|}}}" | </noinclude>{| cellspacing="0" cellpadding="0" style="clear: {{{clear|right}}}; margin-bottom: .5em; float: right; padding: .5em 0 .8em 1.4em; background: none; width: {{{1|auto}}};" class="toclimit-{{#expr: 1 + {{{show|11}}} }} {{{num|}}}" | ||
Line 8: | Line 8: | ||
This template can be used to wrap page text around a right-side table of contents box and, optionally, show only 1 to 10 of the possible indentation 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. | This template can be used to wrap page text around a right-side table of contents box and, optionally, show only 1 to 10 of the possible indentation 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. | ||
− | '''Note:''' The optional features work with the monobook skin, but not currently with the default | + | '''Note:''' The optional features work with the [http://wiki.sugarlabs.org/index.php?title=Template:TOCright&useskin=monobook MonoBook skin], but not currently with the default ShikiWiki skin. |
===Common usage=== | ===Common usage=== | ||
* <code><nowiki>{{TOCright}}</nowiki></code> - Entered on the page where you want the top of the table of contents box to appear. | * <code><nowiki>{{TOCright}}</nowiki></code> - Entered on the page where you want the top of the table of contents box to appear. | ||
Line 22: | Line 22: | ||
*: For instance, using <tt>show=1</tt> will show only the left-most headings and exclude any headings that would be indented 1 or more levels; <tt>show=2</tt> will show 2 indentation levels in the table of contents as calculated according to the indentation rules above. | *: For instance, using <tt>show=1</tt> will show only the left-most headings and exclude any headings that would be indented 1 or more levels; <tt>show=2</tt> will show 2 indentation levels in the table of contents as calculated according to the indentation rules above. | ||
*:: (Headings with low priority encodings, like <tt>=====H5=====</tt> may appear at shallow indentations when entered first on the page or above higher priority headings. (The styles of the headings, as presented in the page body, are unaffected by the table of contents indentation logic.) | *:: (Headings with low priority encodings, like <tt>=====H5=====</tt> may appear at shallow indentations when entered first on the page or above higher priority headings. (The styles of the headings, as presented in the page body, are unaffected by the table of contents indentation logic.) | ||
− | ===Show headings | + | ===Show headings with numbering=== |
− | * <code><nowiki>{{TOCright|num= | + | * <code><nowiki>{{TOCright|num=numtoc}}</nowiki></code> - Adds numbers prefixing the section heading titles. |
*: The <tt>show</tt> and <tt>num</tt> parameters are implemented through [[wikipedia:Cascading Style Sheets|CSS]] classes in the [[MediaWiki:Common.css]]. | *: The <tt>show</tt> and <tt>num</tt> parameters are implemented through [[wikipedia:Cascading Style Sheets|CSS]] classes in the [[MediaWiki:Common.css]]. | ||
<!-- | <!-- |
Latest revision as of 13:37, 27 July 2010
Table of Contents (TOC) - right
This template can be used to wrap page text around a right-side table of contents box and, optionally, show only 1 to 10 of the possible indentation 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.
Note: The optional features work with the MonoBook skin, but not currently with the default ShikiWiki skin.
Common usage
{{TOCright}}
- Entered on the page where you want the top of 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 coded for the heading by the number of paired 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 the first =H1= level heading is entered in the page content after an ====H4==== or deeper heading, it will appear in the table of contents at the indent level of the preceding heading and reset the left-most indentation to that level. This aids the table of contents display when a page is transcluded into a page at a level of ====H4==== or below.
Show only 1 to 10 indentation levels
{{TOCright|show=1}}
(range: [1–10], anything else has no effect) - Shows only the designated number of indentation levels in the table of contents headings, if they are available.- For instance, using show=1 will show only the left-most headings and exclude any headings that would be indented 1 or more levels; show=2 will show 2 indentation levels in the table of contents as calculated according to the indentation rules above.
- (Headings with low priority encodings, like =====H5===== may appear at shallow indentations when entered first on the page or above higher priority headings. (The styles of the headings, as presented in the page body, are unaffected by the table of contents indentation logic.)
- For instance, using show=1 will show only the left-most headings and exclude any headings that would be indented 1 or more levels; show=2 will show 2 indentation levels in the table of contents as calculated according to the indentation rules above.
Show headings with numbering
{{TOCright|num=numtoc}}
- Adds numbers prefixing the section heading titles.- The show and num parameters are implemented through CSS classes in the MediaWiki:Common.css.
Heading hierarchy example
H1
H2
H3
H4
H5
H6
- The above heading results when
======H6======
- is entered.
H1
- ...
=H1=
- entered.
H2
==H2==
H3
===H3===
H4
====H4====
H5
=====H5=====
H6
======H6======
H1
=H1=
H5
=====H5=====
H2
==H2==
H6
======H6======
=H7=
=======H7=======
==H8==
========H8========