Difference between revisions of "Template:Compact ToC"

From DMARC Wiki
Jump to navigation Jump to search
m (Usage: Dox update.)
m (113 revisions imported)
 
(81 intermediate revisions by 34 users not shown)
Line 1: Line 1:
{| id="toc" class="toc" summary="Contents" {{#ifeq:{{{center|}}}|yes|align="center"|}}{{#ifeq:{{{right|}}}|yes|align="right"|}}
+
{{#if:{{{allowtoc|}}}||__NOTOC__}}<!--
! {{MediaWiki:Toc}}{{#ifeq:{{{side|}}}|yes|:|}}
+
-->{{#ifeq:{{{center|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |
{{#ifeq:{{{side|}}}|yes|{{!}}|{{!}}-}}
+
<div style="text-align:center;"><!--
|{{#ifeq:{{{top|}}}|yes|[[#top{{!}}Top]]&nbsp;|}}{{#ifeq:{{{sym|}}}|yes|[[#!$@|!$@]]&nbsp;|}}{{#ifeq:{{{num|}}}|yes|[[#0–9|0–9]]&nbsp;|}}{{#ifeq:{{{symnum|}}}|yes|[[#!–9|!–9]]&nbsp;|}}[[#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]] {{#ifeq:{{{nobreak|}}}|yes|&nbsp;|<br />
+
-->}}<!--
<div style="text-align:center;">}}{{#ifeq:{{{seealso|}}}|yes|[[#See also{{!}}&nbsp;See also&nbsp;]]|}} {{#ifeq:{{{refs|}}}|yes|[[#References{{!}}&nbsp;References&nbsp;]]|}} {{#ifeq:{{{notes|}}}|yes|[[#Notes{{!}}&nbsp;Notes&nbsp;]]|}} {{#ifeq:{{{extlinks|}}}|yes|[[#External links{{!}}&nbsp;External links&nbsp;]]|}}</div>
 
|}__NOTOC__<noinclude>
 
  
 +
Start contents box
  
----
+
--><div id="toc" class="toc plainlinks hlist"
{{Intricate template}}
+
        style="{{#ifeq:{{{center|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |margin-left:auto;margin-right:auto;
==Purpose==
+
                | {{#ifeq:{{{right}}}|yes |clear:right;float:right;}}
This Table of Contents replacement for alphabetical lists provides all the features of [[Template:CompactTOC7]], plus ones from [[Template:CompactTOC2]], etc. that #7 doesn't have (the "Top" "0-9" sections, optionally), ''and'' allows you to select what other sections you want. Even the centering is optional, and you can have the "Contents" heading on the top (default) or the side.
+
                }} text-align:{{{align|left}}};">
 +
<!--
  
==Usage==
+
"[name]/Contents"
  
'''Typical''':
+
    -->{{#ifeq:{{{name}}}|no |
 +
        |  <div id="toctitle" style="text-align:center;{{#ifeq:{{{side|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |display:inline-block;}}"><!--
 +
              --><span style="font-weight:bold;">{{{name|{{MediaWiki:Toc}}&nbsp;}}}{{#ifeq:{{{side|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |&#58;<!--(colon)-->}}</span><!--
 +
          --></div><!--
 +
    -->}}
 +
<!--
  
<code><nowiki>{{</nowiki>'''CompactTOC8'''|symnum=yes<nowiki>}}</nowiki></code>
+
Links
  
 +
    --><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}}} }}} }}} }}}]] <!--
 +
                                -->}} {{#if:{{{prebreak|}}} |{{#ifeq:{{{prebreak|}}}|yes|<br />|{{{prebreak}}}[[Category:Pages using compact toc with deprecated syntax]]}}</ul>}} <!--
 +
-->{{#ifeq:{{{sym}}}|yes |
 +
* [[#!$@|!$@]] }}<!--
 +
-->{{#ifeq:{{{num}}}|yes |
 +
* {{{0-9|[[#0–9|0–9]]}}} }}<!--
 +
-->{{#ifeq:{{{symnum}}}|yes |
 +
* [[#!–9|!–9]] }}{{#ifeq:{{{letters}}}|no||
 +
* {{{a|[[#A|A]]}}}
 +
* {{{b|[[#B|B]]}}}
 +
* {{{c|[[#C|C]]}}}
 +
* {{{d|[[#D|D]]}}}
 +
* {{{e|[[#E|E]]}}}
 +
* {{{f|[[#F|F]]}}}
 +
* {{{g|[[#G|G]]}}}
 +
* {{{h|[[#H|H]]}}}
 +
* {{{i|[[#I|I]]}}}
 +
* {{{j|[[#J|J]]}}}
 +
* {{{k|[[#K|K]]}}}
 +
* {{{l|[[#L|L]]}}}
 +
* {{{m|[[#M|M]]}}}
 +
* {{{n|[[#N|N]]}}}
 +
* {{{o|[[#O|O]]}}}
 +
* {{{p|[[#P|P]]}}}
 +
* {{{q|[[#Q|Q]]}}}
 +
* {{{r|[[#R|R]]}}}
 +
* {{{s|[[#S|S]]}}}
 +
* {{{t|[[#T|T]]}}}
 +
* {{{u|[[#U|U]]}}}
 +
* {{{v|[[#V|V]]}}}
 +
* {{{w|[[#W|W]]}}}
 +
* {{{x|[[#X|X]]}}}
 +
* {{{y|[[#Y|Y]]}}}
 +
* {{{z|[[#Z|Z]]}}}}} <!--
 +
-->{{#ifeq:{{{nobreak|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes | |</ul>}}<!--
  
'''For alphabetical only''' (no number or symbol entries):
+
Custom links
  
<code><nowiki>{{</nowiki>'''CompactTOC8'''<nowiki>}}</nowiki></code>
+
-->{{#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
  
'''For maximum number of features and centered placement''' (leave off a parameter or change it to blank or "no" to disable a feature'''
+
-->{{#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><!--
  
<code><nowiki>{{</nowiki>'''CompactTOC8'''|side=yes|center=yes|right=|nobreak=yes|top=yes|num=yes|sym=yes|symnum=|seealso=yes|refs=yes|notes=yes|extlinks=yes<nowiki>}}</nowiki></code>
+
End contents box
  
''or''
+
--></div><!--
  
<code><nowiki>{{</nowiki>'''CompactTOC8'''<br />|side=yes<br />|center=yes<br />|right=<br />|nobreak=yes<br />|top=yes<br />|num=yes<br />|sym=yes<br />|symnum=<br />|seealso=yes<br />|refs=yes<br />|notes=yes<br />|extlinks=yes
+
-->{{#ifeq:{{{center|{{#ifeq:{{{1}}}|short1|yes}}}}}|yes |
<br /><nowiki>}}</nowiki></code>
+
</div><!--
 +
-->}}<noinclude>
  
===Parameters===
+
{{Documentation}}
*<code>side=yes</code> &mdash; put the "Contents" heading on the left side with a colon, instead of the top without one
 
*<code>center=yes</code> &mdash; center to ToC in the horizontal middle of the page, instead of floated left
 
*<code>right=yes</code> &mdash; align the ToC horizontally to the right of the page (may require <code><nowiki><br style="clear:right;" /></nowiki></code> after it, depending on page layout), instead of floated left (this parameter is mutually exclusive with the "center" option above, and should be used sparingly and with good reason)
 
*<code>nobreak=yes</code> &mdash; no linebreak between the A-B-C-etc. stuff and the See also/References/etc. stuff (note: does not affect the heading; use <code>side=</code> for that)
 
*<code>top=yes</code> &mdash; enable the "Top" link; this is only useful if this copy of the ToC is at the bottom (or middle, theoretically) of the page, as a secondary ToC (every rendered page has a hidden <code><nowiki><a name="top" id="top"></a></nowiki></code> above the sitenotice which makes this link work without having to do anything but enable it in the template)
 
*<code>sym=yes</code> &mdash; enable the "!$@" link for symbolic entries section
 
*<code>num=yes</code> &mdash; enable the "0–9" link for numeric entries section (note that it is "–", the en-dash, not "-", the hyphen-minus at upper right of most keyboards)
 
*<code>symnum=yes</code> &mdash; enable the "!–9" link for combined symbolic and numeric entries section (note that it is "–" not "-", and that the preceding two options are mutually exclusive with this one)
 
*<code>seealso=yes</code> &mdash; enable link to the "See also" section (note that it is plural)
 
*<code>refs=yes</code> &mdash; enable link to the "References" section (note that it is plural)
 
*<code>notes=yes</code> &mdash; enable link to the "Notes" section (note that it is plural)
 
*<code>extlinks=yes</code> &mdash; enable link to the "External links" section
 
 
 
===Examples===
 
{{tlx|CompactTOC8|top&#61;yes}}
 
{{CompactTOC8|top=yes}}
 
 
 
 
 
 
 
{{tlx|CompactTOC8|center&#61;yes|top&#61;yes|seealso&#61;yes}}
 
{{CompactTOC8|center=yes|top=yes|seealso=yes|notes=yes}}
 
 
 
 
 
 
 
{{tlx|CompactTOC8|side&#61;yes|sym&#61;yes|num&#61;yes|refs&#61;yes}}
 
{{CompactTOC8|side=yes|sym=yes|num=yes|refs=yes}}
 
 
 
 
 
 
 
{{tlx|CompactTOC8|top&#61;no|refs&#61;yes|notes&#61;yes|extlinks&#61;yes}}
 
{{CompactTOC8|top=no|refs=yes|notes=yes|extlinks=yes}}
 
 
 
 
 
 
 
{{tlx|CompactTOC8|side&#61;yes|right&#61;yes|symnum&#61;yes|seealso&#61;yes}}
 
{{CompactTOC8|side=yes|right=yes|symnum=yes|seealso=yes}}<br style="clear:right;" />
 
 
 
 
 
 
 
<code><nowiki>{{</nowiki>'''CompactTOC8'''<nowiki>|side=yes|center=yes|nobreak=yes|top=yes|num=yes|sym=yes|seealso=yes|refs=yes|notes=yes|extlinks=yes}}</nowiki></code>
 
{{CompactTOC8|side=yes|center=yes|nobreak=yes|top=yes|num=yes|sym=yes|seealso=yes|refs=yes|notes=yes|extlinks=yes}}
 
 
 
 
 
[[Category:TOC templates]]
 
[[Category:Templates using ParserFunctions]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 02:44, 17 July 2015

{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}