TOC – Template
Jump to navigation
Jump to search
Lou Montana (talk | contribs) (Add subTOC, made 'mode' case-insensitive) |
Lou Montana (talk | contribs) m (New TOC format after 1.35 → 1.39 update) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
| | | | ||
<div class="toc" style="font-size: .9em"> | <div class="toc" style="font-size: .9em"> | ||
<div class="toctitle"> | {{#if:{{{title|a}}}|<div class="toctitle">'''{{{title|Contents}}}'''</div>}} | ||
{{{content}}} | {{{content}}} | ||
</div> | </div> | ||
| | | | ||
{{TemplateCase||[[Category:TOC template usage error]]}} | |||
}} | }} | ||
| | | | ||
__TOC__ | |||
}}</div></includeonly><noinclude> | }}</div></includeonly><noinclude> | ||
{{Feature | important | Only '''one''' TOC (Table of Contents) is possible per page, with the exception of | {{Feature |important|Only '''one''' TOC (Table of Contents) is possible per page, with the exception of ''abc'' and ''subtoc''.}} | ||
== Usage == | == Usage == | ||
Line 30: | Line 30: | ||
** horizontal - a horizontal TOC, where full titles are kept | ** horizontal - a horizontal TOC, where full titles are kept | ||
** normal - the normal TOC - can be placed at the wanted position with this | ** normal - the normal TOC - can be placed at the wanted position with this | ||
** none - no TOC on the page (similar to | ** none - no TOC on the page (similar to {{hl|<nowiki>__NOTOC__</nowiki>}}) | ||
** side - sets the TOC to the right | ** side - sets the TOC to the right | ||
** subtoc - creates a TOC-like box. Additional parameters: | ** subtoc - creates a TOC-like box. Additional parameters: | ||
*** title: (Optional, default empty) subTOC title | *** title: (Optional, default empty) subTOC title | ||
*** content: subTOC content, usually a list of | *** content: subTOC content, usually a list of {{Template|Link}} internal links in format:<syntaxhighlight lang="handlebars"> | ||
* 1 | * 1 {{Link|#Title 1}} | ||
* 2 | * 2 {{Link|#Title 2}} | ||
* 3 | * 3 {{Link|#Title 3}} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* size: (Optional, default 1) size in em (e.g | * size: (Optional, default 1) size in em (e.g {{hl|.9}} for 90%) | ||
* limit: (Optional, default empty) sub-level limit (e.g | * limit: (Optional, default empty) sub-level limit (e.g {{hl|2}}) | ||
* nonum: (Optional, default empty) | * nonum: (Optional, default empty) {{hl|y}} to hide numbers | ||
{| style="width: 100%" | {| style="width: 100%" | ||
Line 48: | Line 48: | ||
! Code | ! Code | ||
! Result | ! Result | ||
|- | |||
| <pre>{{TOC}}</pre> | |||
| style="padding-left: 2.5em" | | |||
{{TOC}} | |||
|- | |- | ||
| <pre>{{TOC|abc}}</pre> | | <pre>{{TOC|abc}}</pre> | ||
Line 54: | Line 58: | ||
| <pre>{{TOC|subtoc | | <pre>{{TOC|subtoc | ||
|content= | |content= | ||
* 1 | * 1 {{Link|#Title 1}} | ||
* 2 | * 2 {{Link|#Title 2}} | ||
* 3 | * 3 {{Link|#Title 3}} | ||
}}</pre> | }}</pre> | ||
| style="padding-left: 2.5em" | | | style="padding-left: 2.5em" | | ||
{{TOC|subtoc | {{TOC|subtoc | ||
|content= | |content= | ||
* 1 | * 1 {{Link|#Title 1}} | ||
* 2 | * 2 {{Link|#Title 2}} | ||
* 3 | * 3 {{Link|#Title 3}} | ||
}} | }} | ||
|- | |- | ||
Line 69: | Line 73: | ||
|title= The sub-TOC title | |title= The sub-TOC title | ||
|content= | |content= | ||
* 1 | * 1 {{Link|#Title 1}} | ||
* 2 | * 2 {{Link|#Title 2}} | ||
* 3 | * 3 {{Link|#Title 3}} | ||
}}</pre> | }}</pre> | ||
| style="padding-left: 2.5em" | | | style="padding-left: 2.5em" | | ||
Line 77: | Line 81: | ||
|title= The sub-TOC title | |title= The sub-TOC title | ||
|content= | |content= | ||
* 1. {{ | * 1 {{Link|#Title 1}} | ||
* 2 | * 2 {{Link|#Title 2}} | ||
* 3 | * 3 {{Link|#Title 3}} | ||
}} | |||
|- | |||
| <pre>{{TOC|subtoc | |||
|title= | |||
|content= | |||
* 1 {{Link|#Title 1}} | |||
* 2 {{Link|#Title 2}} | |||
* 3 {{Link|#Title 3}} | |||
}}</pre> | |||
| style="padding-left: 2.5em" | | |||
{{TOC|subtoc | |||
|title= | |||
|content= | |||
* 1 {{Link|#Title 1}} | |||
* 2 {{Link|#Title 2}} | |||
* 3 {{Link|#Title 3}} | |||
}} | }} | ||
|} | |} | ||
Line 105: | Line 125: | ||
--> | --> | ||
[[Category:Templates|{{uc:{{PAGENAME}}}}]] | [[Category:Templates|{{uc:{{PAGENAME}}}}]]</noinclude> | ||
</noinclude> |
Latest revision as of 18:43, 5 August 2024
Usage
{{TOC|mode|size|limit|nonum|title=|content=}}
- mode: (Optional, default: "normal"; case-insensitive) one of:
- abc - a horizontal A..Z TOC (more of an index)
- horizontal - a horizontal TOC, where full titles are kept
- normal - the normal TOC - can be placed at the wanted position with this
- none - no TOC on the page (similar to __NOTOC__)
- side - sets the TOC to the right
- subtoc - creates a TOC-like box. Additional parameters:
- title: (Optional, default empty) subTOC title
- content: subTOC content, usually a list of {{Link}} internal links in format:
- size: (Optional, default 1) size in em (e.g .9 for 90%)
- limit: (Optional, default empty) sub-level limit (e.g 2)
- nonum: (Optional, default empty) y to hide numbers
Code | Result |
---|---|
{{TOC}} |
|
{{TOC|abc}} |
|
{{TOC|subtoc |content= * 1 {{Link|#Title 1}} * 2 {{Link|#Title 2}} * 3 {{Link|#Title 3}} }} |
|
{{TOC|subtoc |title= The sub-TOC title |content= * 1 {{Link|#Title 1}} * 2 {{Link|#Title 2}} * 3 {{Link|#Title 3}} }} |
|
{{TOC|subtoc |title= |content= * 1 {{Link|#Title 1}} * 2 {{Link|#Title 2}} * 3 {{Link|#Title 3}} }} |