Template:TOC: Difference between revisions

From Space Station 14 Wiki
(wip)
(cats)
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
--><templatestyles src="Template:TOC/styles.css" /><!--
--><templatestyles src="Template:TOC/styles.css" /><!--


-->{{#vardefine: toc_depth_css_class | {{#switch: {{{depth|6}}}
-->{{#vardefine: toc_depth_css_class| {{#switch: {{{depth|6}}}
| 2 = toclimit-2
| 2 = toclimit-2
| 3 = toclimit-3
| 3 = toclimit-3
Line 9: Line 9:
}}}}<!--
}}}}<!--


-->{{#vardefine: toc_float_css|<!--
-->{{#ifeq: {{#vardefineecho: toc_float|{{lc:{{{float|none}}}}}<!--/vardefine-->}}|none<!--
    -->{{#ifeq: {{#vardefineecho: toc_float|{{lc:{{{float|none}}}}}<!--/vardefine-->}}<!--
    -->|<!--
        -->|none<!--
    -->|{{#vardefine: toc_depth_css_class|float-{{#var:toc_float}}<!--/vardef-->}}<!--
        -->|<!--
        -->|float: {{#var:toc_float}}; margin-{{#ifeq: {{#var:toc_float}}|left|right|left}}: var(--toc-margin);<!--
        -->}}<!--
-->}}<!--
-->}}<!--
 
     
--><div class="custom-toc {{#var:toc_depth_css_class}}" style="
--><div class="custom-toc {{#var:toc_depth_css_class}}" style="
     {{#var: toc_float_css}}
     {{#var: toc_float_css}}
Line 26: Line 23:
}}
}}


[[Category:TOC templates]]
[[Category:Template starter-kit]]
<templatedata>
<templatedata>
{
{
Line 64: Line 63:
}
}
</templatedata>
</templatedata>
[[Category:Main Templates]]
 
</noinclude>
</noinclude>

Latest revision as of 10:56, 24 August 2024


Template documentation
view or edit this documentation about template documentation
Has an alias
This template has an alternative name:
Uses template styles
This template uses template styles found in:

Since TOC relies on a page contents and can only be used once, the examples isolated into separate pages:

Page Description
Template:TOC/examples/basic Basic usage with no params.
Template:TOC/examples/depth param "depth" param example.
Template:TOC/examples/float param "float" param example.

TOC with extra shenanigans, such as hiding deep headers or floating the TOC right or left. Note that this template forces the TOC onto the page, regardless of the number of headers on the page. This template uses the regular TOC, so all its quirks and limitation apply too (e.g. displaying only the latest TOC).

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Depthdepth

The depth of headers shown in the TOC. Default is «6» (all headers).

Suggested values
2 3 4 5 6
Default
6
Linesuggested
Floatfloat

Floating of the TOC. Any casing (including lowercase) is supported.

Suggested values
Left Right None
Default
None
Stringsuggested