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

From blackwiki
Jump to navigation Jump to search
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|List TOC}}
+
*[[Help:TOC]]
 +
* {{tl|Compact ToC}}
 
* {{tl|List TOC Letters}}
 
* {{tl|List TOC Letters}}
  
<includeonly>
+
<templatedata>
<!-- Categories and interwikis go here: -->
+
{
 +
"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

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

This template lays out the table of contents in a horizontal list rather than a vertical one.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
No numbersnonum

Hide the generated heading numbers

Example
yes
Stringoptional
Limitlimit

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

Numberoptional
No parenthesisno_parenthesis

Separates entries by bullets, regardless of sub-sections.

Example
yes
Stringoptional
Alignalign

Which side of the page to align the ToC to. Allowed values are left, right, center

Example
align=left
Stringoptional
Clearclear

Align underneath floating images and tables or not. Allowed values are left, right, both, none

Example
clear:both
Stringoptional
Linkslinks

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]]
Stringoptional