TOC – Template
| Lou Montana (talk | contribs) m (Add arguments) | Lou Montana (talk | contribs)  m (Add Vector 2022 skin intel) | ||
| (18 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| <includeonly><div class="{{#if:{{{3|}}}|toclimit-{{{3|}}} | <includeonly><div class="{{#if:{{{3|}}}|toclimit-{{{3|}}}}} {{#if:{{{4|}}}|toc-nonum}}" {{#if:{{{2|}}}|style="font-size: {{{2}}}em"}}>{{#switch:{{lc:{{{1|}}}}} | ||
| |abc= | |abc= | ||
| 	<div class="toc- | 	__NOTOC__ | ||
| 	<div class="toc-abc">[[#A|A]][[#B|B]][[#C|C]][[#D|D]][[#E|E]][[#F|F]][[#G|G]][[#H|H]][[#I|I]][[#J|J]][[#K|K]][[#L|L]][[#M|M]][[#N|N]][[#O|O]][[#P|P]][[#Q|Q]][[#R|R]][[#S|S]][[#T|T]][[#U|U]][[#V|V]][[#W|W]][[#X|X]][[#Y|Y]][[#Z|Z]][[##|#]]</div> | |||
| |horizontal= | |horizontal= | ||
| 	<div class="toc-horizontal">__TOC__</div> | 	<div class="toc-horizontal">__TOC__</div> | ||
| Line 7: | Line 8: | ||
| 	__NOTOC__ | 	__NOTOC__ | ||
| |side= | |side= | ||
| 	<div class="toc-side" style="font-size: {{{ | 	<div class="toc-side">__TOC__</div> | ||
| | | |subtoc= | ||
| 	{{#if:{{{content|}}} | |||
| 	| | |||
| 		<div class="toc" style="font-size: .9em"> | |||
| 		{{#if:{{{title|a}}}|<div class="toctitle">'''{{{title|Contents}}}'''</div>}} | |||
| {{{content}}} | |||
| 		</div> | |||
| 	| | |||
| 		{{TemplateCase||[[Category:TOC template usage error]]}} | |||
| 	}} | |||
| |#default= | |||
| 	__TOC__ | 	__TOC__ | ||
| }}</div></includeonly><noinclude> | }}</div></includeonly><noinclude> | ||
| {{ | {{Feature |important|Only '''one''' TOC (Table of Contents) is possible per page, with the exception of ''abc'' and ''subtoc''.}} | ||
| == Usage == | == Usage == | ||
| {{<nowiki/>TOC|'''''mode'''''|'''''size'''''|'''''limit'''''|''''' | {{<nowiki/>TOC|'''''mode'''''|'''''size'''''|'''''limit'''''|'''''nonum'''''|'''''title='''''|'''''content='''''}} | ||
| * mode: (Optional, default "normal"  | * mode: (Optional, default: "normal"; case-insensitive) one of: | ||
| ** abc - a horizontal A..Z TOC (more of an ''index'') | ** abc - a horizontal A..Z TOC (more of an ''index'') | ||
| ** 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 | ||
| * size: (Optional, default 1) size in em (e.g  | ** subtoc - creates a TOC-like box. Additional parameters: | ||
| * limit: (Optional, default empty) sub-level limit (e.g  | *** title: (Optional, default empty) subTOC title | ||
| *  | *** content: subTOC content, usually a list of {{Template|Link}} internal links in format:<syntaxhighlight lang="handlebars"> | ||
| * 1 {{Link|#Title 1}} | |||
| * 2 {{Link|#Title 2}} | |||
| * 3 {{Link|#Title 3}} | |||
| </syntaxhighlight> | |||
| * size: (Optional, default 1) size in em (e.g {{hl|.9}} for 90%) | |||
| * limit: (Optional, default empty) sub-level limit (e.g {{hl|2}}) | |||
| * nonum: (Optional, default empty) {{hl|y}} to hide numbers | |||
| {{Feature|important|{{hl|horizontal}}, {{hl|normal}} and {{hl|side}} values do not work anymore using the Vector 2022 skin.}} | |||
| {| style="width: 100%" | |||
| |+ Examples | |||
| |- style="background-color: #EEE" | |||
| ! Code | |||
| ! Result | |||
| |- | |||
| | <pre>{{TOC}}</pre> | |||
| | style="padding-left: 2.5em" | | |||
| {{TOC}} | |||
| |- | |||
| | <pre>{{TOC|abc}}</pre> | |||
| | {{TOC|abc}} | |||
| |- | |||
| | <pre>{{TOC|subtoc | |||
| |content= | |||
| * 1 {{Link|#Title 1}} | |||
| * 2 {{Link|#Title 2}} | |||
| * 3 {{Link|#Title 3}} | |||
| }}</pre> | |||
| | style="padding-left: 2.5em" | | |||
| {{TOC|subtoc | |||
| |content= | |||
| * 1 {{Link|#Title 1}} | |||
| * 2 {{Link|#Title 2}} | |||
| * 3 {{Link|#Title 3}} | |||
| }} | |||
| |- | |||
| | <pre>{{TOC|subtoc | |||
| |title= The sub-TOC title | |||
| |content= | |||
| * 1 {{Link|#Title 1}} | |||
| * 2 {{Link|#Title 2}} | |||
| * 3 {{Link|#Title 3}} | |||
| }}</pre> | |||
| | style="padding-left: 2.5em" | | |||
| {{TOC|subtoc | |||
| |title= The sub-TOC title | |||
| |content= | |||
| * 1 {{Link|#Title 1}} | |||
| * 2 {{Link|#Title 2}} | |||
| * 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}} | |||
| }} | |||
| |} | |||
| <!-- | <!-- | ||
| {| class="wikitable" style="width: 100%" | {| class="wikitable" style="width: 100%" | ||
| Line 48: | Line 127: | ||
| --> | --> | ||
| [[Category:Templates|{{uc:{{PAGENAME}}}}]] | [[Category:Templates|{{uc:{{PAGENAME}}}}]]</noinclude> | ||
| </noinclude> | |||
Latest revision as of 15:27, 9 April 2025
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}}
}} | 
