Difference between revisions of "Template:Horizontal TOC/doc"
imported>Sillyfolkboy (add limit depth) |
imported>PrimeHunter (Undid revision 809876430 by Hyacinth (talk). This produces nothing on Template:Horizontal TOC where only the TOC at top of the page is shown. There can be only one) |
||
| (38 intermediate revisions by 18 users not shown) | |||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- Categories and interwikis go at the bottom of this page. --> | <!-- Categories and interwikis go at the bottom of this page. --> | ||
| + | {{Uses TemplateStyles|Template:TOC limit/styles.css|Template:Horizontal TOC/styles.css|Template:Horizontal TOC/horizontal-toc-no-parentheses.css|noprotcat=yes}} | ||
This template lays out the table of contents in a [[WP:HLIST|horizontal list]] rather than a vertical one. | This template lays out the table of contents in a [[WP:HLIST|horizontal list]] rather than a vertical one. | ||
| Line 9: | Line 10: | ||
{{horizontal TOC}} | {{horizontal TOC}} | ||
</pre> | </pre> | ||
| − | |||
There is no need to specify <code><nowiki>__NOTOC__</nowiki></code>: this template handles that automatically. | There is no need to specify <code><nowiki>__NOTOC__</nowiki></code>: this template handles that automatically. | ||
| + | *[https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960465 See example] | ||
To hide the generated heading numbers, use: | To hide the generated heading numbers, use: | ||
| Line 16: | Line 17: | ||
<pre> | <pre> | ||
{{horizontal TOC|nonum=yes}} | {{horizontal TOC|nonum=yes}} | ||
| + | </pre> | ||
| + | *[https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960502 See example] | ||
| + | |||
| + | To suppress the parentheses around subsection lists, use: | ||
| + | |||
| + | <pre> | ||
| + | {{horizontal TOC|noparens=yes}} | ||
</pre> | </pre> | ||
| Line 23: | Line 31: | ||
{{horizontal TOC|limit=2}} | {{horizontal TOC|limit=2}} | ||
</pre> | </pre> | ||
| + | *[https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960535 See example] | ||
| + | |||
| + | To float the table of contents to the center of the page, use: | ||
| + | |||
| + | <pre> | ||
| + | {{horizontal TOC|align=center}} | ||
| + | </pre> | ||
| + | *[https://en.wikipedia.org/w/index.php?title=Template:Horizontal_TOC/doc&oldid=653960585 See example] | ||
| + | |||
| + | For country and state lists with flag icons, see these examples: [[Legality of cannabis by country]]. And: [[Legality of cannabis by U.S. jurisdiction]]. | ||
== See also == | == See also == | ||
| − | * {{tl| | + | *[[Help:TOC]] |
| + | * {{tl|Compact ToC}} | ||
* {{tl|List TOC Letters}} | * {{tl|List TOC Letters}} | ||
| − | <includeonly> | + | <templatedata> |
| − | <!-- Categories | + | { |
| + | "params": { | ||
| + | "nonum": { | ||
| + | "label": "No numbers", | ||
| + | "description": "Hide the generated heading numbers", | ||
| + | "example": "yes", | ||
| + | "type": "string" | ||
| + | }, | ||
| + | "limit": { | ||
| + | "label": "Limit", | ||
| + | "description": "Limits the depth of subheadings shown. For instance using limit=4 will hide the fourth level and deeper subheadings in the hierarchy. And limit=2 will hide all subheadings leaving only the main headings. This works by hiding the lower levels with CSS", | ||
| + | "type": "number" | ||
| + | }, | ||
| + | "no_parenthesis": { | ||
| + | "label": "No parenthesis", | ||
| + | "description": "Separates entries by bullets, regardless of sub-sections.", | ||
| + | "example": "yes", | ||
| + | "type": "string" | ||
| + | }, | ||
| + | "align": { | ||
| + | "label": "Align", | ||
| + | "description": "Which side of the page to align the ToC to. Allowed values are left, right, center", | ||
| + | "example": "align=left", | ||
| + | "type": "string" | ||
| + | }, | ||
| + | "clear": { | ||
| + | "label": "Clear", | ||
| + | "description": "Align underneath floating images and tables or not. Allowed values are left, right, both, none", | ||
| + | "example": "clear:both", | ||
| + | "type": "string" | ||
| + | }, | ||
| + | "links": { | ||
| + | "label": "Links", | ||
| + | "description": "Specify a list of links for the table of contents instead of the section links automatically generated by the TOC magic word", | ||
| + | "example": "* [[#Season 1|1]]", | ||
| + | "type": "string" | ||
| + | } | ||
| + | |||
| + | }, | ||
| + | "description": "This template lays out the table of contents in a horizontal list rather than a vertical one.", | ||
| + | "format": "inline" | ||
| + | } | ||
| + | </templatedata> | ||
| + | |||
| + | <includeonly>{{Sandbox other|| | ||
| + | <!-- Categories go here --> | ||
[[Category:Wikipedia table of contents templates]] | [[Category:Wikipedia table of contents templates]] | ||
| − | </includeonly> | + | }}</includeonly> |
Latest revision as of 17:07, 6 February 2021
| This is a documentation subpage for Template:Horizontal TOC. It contains usage information, categories and other content that is not part of the original template page. |
Script error: No such module "Uses TemplateStyles".
This template lays out the table of contents in a horizontal list rather than a vertical one.
Usage
{{horizontal TOC}}
There is no need to specify __NOTOC__: this template handles that automatically.
To hide the generated heading numbers, use:
{{horizontal TOC|nonum=yes}}
To suppress the parentheses around subsection lists, use:
{{horizontal TOC|noparens=yes}}
To limit the depth of the generated headings to the first headings only, use:
{{horizontal TOC|limit=2}}
To float the table of contents to the center of the page, use:
{{horizontal TOC|align=center}}
For country and state lists with flag icons, see these examples: Legality of cannabis by country. And: Legality of cannabis by U.S. jurisdiction.
See also
- Help:TOC
- {{Compact ToC}}
- {{List TOC Letters}}
This template lays out the table of contents in a horizontal list rather than a vertical one.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| No numbers | nonum | Hide the generated heading numbers
| String | optional |
| Limit | limit | Limits the depth of subheadings shown. For instance using limit=4 will hide the fourth level and deeper subheadings in the hierarchy. And limit=2 will hide all subheadings leaving only the main headings. This works by hiding the lower levels with CSS | Number | optional |
| No parenthesis | no_parenthesis | Separates entries by bullets, regardless of sub-sections.
| String | optional |
| Align | align | Which side of the page to align the ToC to. Allowed values are left, right, center
| String | optional |
| Clear | clear | Align underneath floating images and tables or not. Allowed values are left, right, both, none
| String | optional |
| Links | links | Specify a list of links for the table of contents instead of the section links automatically generated by the TOC magic word
| String | optional |