Difference between revisions of "Template:TOC top/doc"

From Second Life Wiki
Jump to navigation Jump to search
(Shamelessly copied from wiki.openstreetmap.org)
 
m (Adapted links to Wikipedia)
 
Line 4: Line 4:


== Usage ==
== Usage ==
Please note that this is '''solely for ease of maintaining existing templates'''. Please '''do not use this to write new templates''': instead, browse through [[w:Category:Wikipedia table of contents templates]] and use an existing template. This code is one of the final pieces in cleaning up years of redundant and overlapping code in this area.
Please note that this is '''solely for ease of maintaining existing templates'''. Please '''do not use this to write new templates''': instead, browse through {{Wikipedia|Category:Wikipedia table of contents templates}} and use an existing template. This code is one of the final pieces in cleaning up years of redundant and overlapping code in this area.


=== Parameters (optional) ===
=== Parameters (optional) ===
Line 10: Line 10:
: The title to use for this ToC element. The default is <strong>{{MediaWiki:Toc}}</strong>.
: The title to use for this ToC element. The default is <strong>{{MediaWiki:Toc}}</strong>.
; align
; align
: Sets the [[w:Cascading Style Sheets|CSS]] float and clear properties, which forces this float underneath the side specified with this attribute. So, <code>align=right</code>  will place the element after all the right floating elements before it. Options are <code>left</code>, <code>right</code>, <code>center</code>, or <code>none</code> (default).
: Sets the {{Wikipedia|Cascading Style Sheets|CSS}} float and clear properties, which forces this float underneath the side specified with this attribute. So, <code>align=right</code>  will place the element after all the right floating elements before it. Options are <code>left</code>, <code>right</code>, <code>center</code>, or <code>none</code> (default).
; clear
; clear
: Overrides the default [[w:Cascading Style Sheets|CSS]] clear property set by the align parameter, which is not typically needed.  Options are <code>left</code>, <code>right</code>, <code>both</code>, or <code>none</code>.  The defaults are <code>left</code> when {{Para|align|left}}, <code>right</code> when {{Para|align|right}}, <code>none</code> when {{Para|align|center}}, and <code>left</code> when {{para|align|none}}.  Use {{Para|clear|none}} to allow other floating elements to float next to the table of contents, and {{Para|clear|both}} to force the table of contents to have nothing next to it.
: Overrides the default {{Wikipedia|Cascading Style Sheets|CSS}} clear property set by the align parameter, which is not typically needed.  Options are <code>left</code>, <code>right</code>, <code>both</code>, or <code>none</code>.  The defaults are <code>left</code> when {{Para|align|left}}, <code>right</code> when {{Para|align|right}}, <code>none</code> when {{Para|align|center}}, and <code>left</code> when {{para|align|none}}.  Use {{Para|clear|none}} to allow other floating elements to float next to the table of contents, and {{Para|clear|both}} to force the table of contents to have nothing next to it.
; primary
; primary
: Set this to <code>false</code> if this ToC is not used as the primary ToC of a page. This makes sure that the title of this ToC does not show up in the primary ToC. A side effect of this is the disappearing of the show/hide toggle.
: Set this to <code>false</code> if this ToC is not used as the primary ToC of a page. This makes sure that the title of this ToC does not show up in the primary ToC. A side effect of this is the disappearing of the show/hide toggle.

Latest revision as of 00:18, 14 September 2022

This is used to create custom table of contents templates such as {{TOC}}, {{Category TOC}}, {{List TOC}}. It replaces and suppresses the ToC that the wiki software would automatically generate.

Usage

Please note that this is solely for ease of maintaining existing templates. Please do not use this to write new templates: instead, browse through "Wikipedia logo"Category:Wikipedia table of contents templates and use an existing template. This code is one of the final pieces in cleaning up years of redundant and overlapping code in this area.

Parameters (optional)

title
The title to use for this ToC element. The default is Contents.
align
Sets the "Wikipedia logo"CSS float and clear properties, which forces this float underneath the side specified with this attribute. So, align=right will place the element after all the right floating elements before it. Options are left, right, center, or none (default).
clear
Overrides the default "Wikipedia logo"CSS clear property set by the align parameter, which is not typically needed. Options are left, right, both, or none. The defaults are left when |align = left, right when |align = right, none when |align = center, and left when |align = none. Use |clear = none to allow other floating elements to float next to the table of contents, and |clear = both to force the table of contents to have nothing next to it.
primary
Set this to false if this ToC is not used as the primary ToC of a page. This makes sure that the title of this ToC does not show up in the primary ToC. A side effect of this is the disappearing of the show/hide toggle.

See also