Difference between revisions of "Template:TOC"

From GodWiki
Jump to navigation Jump to search
Tags: mobile edit mobile web edit
m (Category tag)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#if:{{{allowtoc|}}}||__NOTOC__}}<!--
+
<noinclude>{{Construction|date=07:51, 25 August 2020 (UTC)|This template is experimental and may change. I'll avoid making breaking changes if possible, but cannot guarantee it. If you choose to use it on a <code>User:</code> page, I will leave a message on your <code>User talk:</code> notifying you if changes are needed; otherwise I will make any necessary changes on [[Special:WhatLinksHere/Template:TOC|any page using this template]] as required.}}</noinclude>__NOTOC__
-->{{#ifeq:{{{center|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |
+
{| class="wikitable {{{table-class|}}}" style="margin: 0 auto; min-width: 12em; {{{table-style|}}};" aria-label="Table of Contents"
<div style="text-align:center;"><!--
+
|+ Table of Contents
-->}}<!--
+
| {{#if: {{{1|}}}|
 +
# [[#{{#if:{{{1}}}|{{{1}}}}}{{!}}{{#if:{{{1}}}|{{{1}}}}}]]}}{{#if: {{{2|}}}|
 +
# [[#{{#if:{{{2}}}|{{{2}}}}}{{!}}{{#if:{{{2}}}|{{{2}}}}}]]}}{{#if: {{{3|}}}|
 +
# [[#{{#if:{{{3}}}|{{{3}}}}}{{!}}{{#if:{{{3}}}|{{{3}}}}}]]}}{{#if: {{{4|}}}|
 +
# [[#{{#if:{{{4}}}|{{{4}}}}}{{!}}{{#if:{{{4}}}|{{{4}}}}}]]}}{{#if: {{{5|}}}|
 +
# [[#{{#if:{{{5}}}|{{{5}}}}}{{!}}{{#if:{{{5}}}|{{{5}}}}}]]}}{{#if: {{{6|}}}|
 +
# [[#{{#if:{{{6}}}|{{{6}}}}}{{!}}{{#if:{{{6}}}|{{{6}}}}}]]}}{{#if: {{{7|}}}|
 +
# [[#{{#if:{{{7}}}|{{{7}}}}}{{!}}{{#if:{{{7}}}|{{{7}}}}}]]}}{{#if: {{{8|}}}|
 +
# [[#{{#if:{{{8}}}|{{{8}}}}}{{!}}{{#if:{{{8}}}|{{{8}}}}}]]}}{{#if: {{{9|}}}|
 +
# [[#{{#if:{{{9}}}|{{{9}}}}}{{!}}{{#if:{{{9}}}|{{{9}}}}}]]}}{{#if: {{{10|}}}|
 +
# [[#{{#if:{{{10}}}|{{{10}}}}}{{!}}{{#if:{{{10}}}|{{{10}}}}}]]}}{{#if: {{{11|}}}|
 +
# [[#{{#if:{{{11}}}|{{{11}}}}}{{!}}{{#if:{{{11}}}|{{{11}}}}}]]}}{{#if: {{{12|}}}|
 +
# [[#{{#if:{{{12}}}|{{{12}}}}}{{!}}{{#if:{{{12}}}|{{{12}}}}}]]}}{{#if: {{{13|}}}|
 +
# [[#{{#if:{{{13}}}|{{{13}}}}}{{!}}{{#if:{{{13}}}|{{{13}}}}}]]}}{{#if: {{{14|}}}|
 +
# [[#{{#if:{{{14}}}|{{{14}}}}}{{!}}{{#if:{{{14}}}|{{{14}}}}}]]}}{{#if: {{{15|}}}|
 +
# [[#{{#if:{{{15}}}|{{{15}}}}}{{!}}{{#if:{{{15}}}|{{{15}}}}}]]}}{{#if: {{{16|}}}|
 +
# [[#{{#if:{{{16}}}|{{{16}}}}}{{!}}{{#if:{{{16}}}|{{{16}}}}}]]}}{{#if: {{{17|}}}|
 +
# [[#{{#if:{{{17}}}|{{{17}}}}}{{!}}{{#if:{{{17}}}|{{{17}}}}}]]}}{{#if: {{{18|}}}|
 +
# [[#{{#if:{{{18}}}|{{{18}}}}}{{!}}{{#if:{{{18}}}|{{{18}}}}}]]}}{{#if: {{{19|}}}|
 +
# [[#{{#if:{{{19}}}|{{{19}}}}}{{!}}{{#if:{{{19}}}|{{{19}}}}}]]}}{{#if: {{{20|}}}|
 +
# [[#{{#if:{{{20}}}|{{{20}}}}}{{!}}{{#if:{{{20}}}|{{{20}}}}}]]}}
 +
|}{{#ifeq:{{yesno-no|{{{spacer}}}}}|yes|{{spacer}}}}<noinclude>{{doc|content=
 +
==Quick & Dirty Docs==
  
Start contents box
+
First draft, [[User:Djonni|Djonni]] ([[User talk:Djonni|talk]]) 07:51, 25 August 2020 (UTC)
  
--><div role="navigation" {{#if:{{{allowtoc|}}}||id="toc"}} class="toc plainlinks hlist" {{#ifeq:{{{name}}}|no |aria-label="Contents" |aria-labelledby="tocheading"}}
+
Currently supported parameters:
        style="{{#ifeq:{{{center|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |margin-left:auto;margin-right:auto;
 
                | {{#ifeq:{{{right}}}|yes |clear:right;float:right;}}
 
                }} text-align:{{{align|left}}};">
 
<!--
 
  
"[name]/Contents"
+
;Unnamed parameters <code>1..20</code>
 +
:Up to 20 headers in the document to include in the ToC. The text must match the header text ''exactly'' or linking won't work. Note that an {{tlx|anchor}} in the article text may be used instead of a header, if necessary; in which case, the text in the ToC must exactly match the {{tlc|anchor}} text instead.
  
    -->{{#ifeq:{{{name}}}|no |
+
;table-class
        |  <div id="toctitle" class="toctitle" style="text-align:center;{{#ifeq:{{{side|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |display:inline-block;}}"><!--
+
:Additional text to insert into the table's <code>class=</code> attribute. E.g., {{para|table-class|mw-collapsible}}
              --><span id="tocheading" style="font-weight:bold;">{{{name|{{MediaWiki:Toc}}}}}{{#ifeq:{{{side|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |&#58;&nbsp;<!--(colon and space)-->}}</span><!--
 
          --></div><!--
 
    -->}}
 
<!--
 
  
Links
+
;table-style
 
+
:Additional text to insert ''at end'' of the table's <code>style</code> attribute. Will override default style properties if relevant. E.g., {{para|table-style|font-size: large;}}
    --><div style="margin:auto;white-space:nowrap;{{#ifeq:{{{side|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |display:inline-block;}}"><!--
 
            -->{{#ifeq:{{{top}}}|yes |
 
* [[#top|Top]]}}<!--
 
            -->{{#if:{{{pre1|{{{preSec1|}}}}}} |
 
* [[{{{pre1link|{{{preSec1link|#{{{pre1|{{{preSec1}}} }}} }}} }}}|{{{pre1name|{{{preSec1name|{{{pre1|{{{preSec1}}} }}} }}} }}}]] <!--
 
            -->}} {{#if:{{{pre2|{{{preSec2|}}}}}} |
 
* [[{{{pre2link|{{{preSec2link|#{{{pre2|{{{preSec2}}} }}} }}} }}}|{{{pre2name|{{{preSec2name|{{{pre2|{{{preSec2}}} }}} }}} }}}]] <!--
 
              -->}} {{#if:{{{pre3|{{{preSec3|}}}}}} |
 
* [[{{{pre3link|{{{preSec3link|#{{{pre3|{{{preSec3}}} }}} }}} }}}|{{{pre3name|{{{preSec3name|{{{pre3|{{{preSec3}}} }}} }}} }}}]] <!--
 
                  -->}} {{#if:{{{pre4|{{{preSec4|}}}}}} |
 
* [[{{{pre4link|{{{preSec4link|#{{{pre4|{{{preSec4}}} }}} }}} }}}|{{{pre4name|{{{preSec4name|{{{pre4|{{{preSec4}}} }}} }}} }}}]] <!--
 
                    -->}} {{#if:{{{pre5|{{{preSec5|}}}}}} |
 
* [[{{{pre5link|{{{preSec5link|#{{{pre5|{{{preSec5}}} }}} }}} }}}|{{{pre5name|{{{preSec5name|{{{pre5|{{{preSec5}}} }}} }}} }}}]] <!--
 
                        -->}} {{#if:{{{pre6|{{{preSec6|}}}}}} |
 
* [[{{{pre6link|{{{preSec6link|#{{{pre6|{{{preSec6}}} }}} }}} }}}|{{{pre6name|{{{preSec6name|{{{pre6|{{{preSec6}}} }}} }}} }}}]] <!--
 
                          -->}} {{#if:{{{pre7|{{{preSec7|}}}}}} |
 
* [[{{{pre7link|{{{preSec7link|#{{{pre7|{{{preSec7}}} }}} }}} }}}|{{{pre7name|{{{preSec7name|{{{pre7|{{{preSec7}}} }}} }}} }}}]] <!--
 
                              -->}} {{#if:{{{pre8|{{{preSec8|}}}}}} |
 
* [[{{{pre8link|{{{preSec8link|#{{{pre8|{{{preSec8}}} }}} }}} }}}|{{{pre8name|{{{preSec8name|{{{pre8|{{{preSec8}}} }}} }}} }}}]] <!--
 
                                -->}} {{#ifeq:{{{prebreak|}}}|yes|<br />
 
 
 
<nowiki />}}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
 
}}{{#if:{{{y}}}|* {{{y|[[#Y|Y]]}}}
 
}}{{#if:{{{z}}}|* {{{z|[[#Z|Z]]}}}
 
}}}} <!--
 
-->{{#ifeq:{{{nobreak|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes | |<nowiki />
 
 
 
<nowiki />}}<!--
 
 
 
Custom links
 
 
 
-->{{#if:{{{custom1|{{{Sec1|}}}}}} |
 
* [[{{{custom1link|{{{Sec1link|#{{{custom1|{{{Sec1}}} }}} }}} }}}|{{{custom1name|{{{Sec1name|{{{custom1|{{{Sec1}}} }}} }}} }}}]] <!--
 
-->}} {{#if:{{{custom2|{{{Sec2|}}}}}} |
 
* [[{{{custom2link|{{{Sec2link|#{{{custom2|{{{Sec2}}} }}} }}} }}}|{{{custom2name|{{{Sec2name|{{{custom2|{{{Sec2}}} }}} }}} }}}]] <!--
 
  -->}} {{#if:{{{custom3|{{{Sec3|}}}}}} |
 
* [[{{{custom3link|{{{Sec3link|#{{{custom3|{{{Sec3}}} }}} }}} }}}|{{{custom3name|{{{Sec3name|{{{custom3|{{{Sec3}}} }}} }}} }}}]] <!--
 
      -->}} {{#if:{{{custom4|{{{Sec4|}}}}}} |
 
* [[{{{custom4link|{{{Sec4link|#{{{custom4|{{{Sec4}}} }}} }}} }}}|{{{custom4name|{{{Sec4name|{{{custom4|{{{Sec4}}} }}} }}} }}}]] <!--
 
        -->}} {{#if:{{{custom5|{{{Sec5|}}}}}} |
 
* [[{{{custom5link|{{{Sec5link|#{{{custom5|{{{Sec5}}} }}} }}} }}}|{{{custom5name|{{{Sec5name|{{{custom5|{{{Sec5}}} }}} }}} }}}]] <!--
 
            -->}} {{#if:{{{custom6|{{{Sec6|}}}}}} |
 
* [[{{{custom6link|{{{Sec6link|#{{{custom6|{{{Sec6}}} }}} }}} }}}|{{{custom6name|{{{Sec6name|{{{custom6|{{{Sec6}}} }}} }}} }}}]] <!--
 
              -->}} {{#if:{{{custom7|{{{Sec7|}}}}}} |
 
* [[{{{custom7link|{{{Sec7link|#{{{custom7|{{{Sec7}}} }}} }}} }}}|{{{custom7name|{{{Sec7name|{{{custom7|{{{Sec7}}} }}} }}} }}}]] <!--
 
                  -->}} {{#if:{{{custom8|{{{Sec8|}}}}}} |
 
* [[{{{custom8link|{{{Sec8link|#{{{custom8|{{{Sec8}}} }}} }}} }}}|{{{custom8name|{{{Sec8name|{{{custom8|{{{Sec8}}} }}} }}} }}}]] <!--
 
                    -->}}<!--
 
 
 
"See also" etc links
 
 
 
-->{{#ifeq:{{{seealso}}}|yes |
 
* [[#See also|See also]] }}<!--
 
-->{{#ifeq:{{{notesfirst}}}|yes |
 
* [[#Notes|Notes]] }}<!--
 
-->{{#ifeq:{{{refs|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |
 
* [[#References|References]] }}<!--
 
-->{{#ifeq:{{{notes}}}|yes |
 
* [[#Notes|Notes]] }}<!--
 
-->{{#ifeq:{{{further}}}|yes |
 
* [[#Further reading|Further reading]] }}<!--
 
-->{{#ifeq:{{{extlinks}}}|yes |
 
* [[#External links|External links]] <!--
 
-->}}
 
<!-- --></div><!--
 
 
 
End contents box
 
 
 
--></div><!--
 
 
 
-->{{#ifeq:{{{center|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |
 
</div><!--
 
-->}}<noinclude>
 
  
 +
;spacer<var>=yes/no</var>
 +
:Enables or explicitly disables a {{tlx|spacer}} at end of ToC, if necessary for mobile layout. Current default behaviour is {{para|spacer|no}}, but this is subject to testing and shouldn't be relied upon. Any valid {{tlx|yesno}} value works here.}}
 +
[[Category:Templates]][[Category:Formatting templates]]
 
</noinclude>
 
</noinclude>
[[Category:Formatting Templates]]
 

Latest revision as of 08:31, 25 August 2020

📝Under active creation
This article is the target of an editor's creative exploration.
Their message is: This template is experimental and may change. I'll avoid making breaking changes if possible, but cannot guarantee it. If you choose to use it on a User: page, I will leave a message on your User talk: notifying you if changes are needed; otherwise I will make any necessary changes on any page using this template as required.
If you have something to add to this article, please discuss it on the talk page. [07:51, 25 August 2020 (UTC)]
Table of Contents
📚 Documentation

Quick & Dirty Docs

First draft, Djonni (talk) 07:51, 25 August 2020 (UTC)

Currently supported parameters:

Unnamed parameters 1..20
Up to 20 headers in the document to include in the ToC. The text must match the header text exactly or linking won't work. Note that an {{anchor}} in the article text may be used instead of a header, if necessary; in which case, the text in the ToC must exactly match the {{anchor}} text instead.
table-class
Additional text to insert into the table's class= attribute. E.g., |table-class=mw-collapsible
table-style
Additional text to insert at end of the table's style attribute. Will override default style properties if relevant. E.g., |table-style=font-size: large;
spacer=yes/no
Enables or explicitly disables a {{spacer}} at end of ToC, if necessary for mobile layout. Current default behaviour is |spacer=no, but this is subject to testing and shouldn't be relied upon. Any valid {{yesno}} value works here.