User:Gorgon/Sandbox/Sandbox Charlie: Difference between revisions

From Avlis Wiki
Jump to navigation Jump to search
m (Fix for setting "top = no" and all empty defined parameter values.)
m (Lots of tweaks, fixes and improvements. Docs updated.)
Line 1: Line 1:
<noinclude>{{<!-- sec -->User:Gorgon/Sandbox/Sandbox_Beta | User:Gorgon/Sandbox | 1 }}
<noinclude>{{<!-- sec -->User:Gorgon/Sandbox/Sandbox_Beta | User:Gorgon/Sandbox | 1 }}


</noinclude><table id="cattoc" class="toc plainlinks noprint" summary="Contents" align="{{{align|center}}}">
 
</noinclude><table id="cattoc" class="toc plainlinks noprint" summary="Contents" style="border-collapse: separate; padding: 0 5px; white-space: pre;" align="<!--
    // Check which value "align" is set to, and set it. Anything except "left" or "right" defaults to "center".
-->{{#switch: {{lc: {{{align|center}}} }} | left | right = {{lc: {{{align}}} }} | #default = center}}"><!--
    // Set up the TOC row. -->
<tr><th>{{MediaWiki:Toc}}:</th><td><!--
<tr><th>{{MediaWiki:Toc}}:</th><td><!--
-->{{#ifeq:{{lc:{{{top|yes}}}}}|no||&nbsp;&nbsp;&nbsp; [{{fullurl:{{FULLPAGENAME}}}} Top]}}<!--
    // Show the default "Top" link if "top" is set to "yes" (or anything else except "no"). Don't show anything if set to "no".
-->{{#ifeq:{{lc:{{{numerals|group}}}}}|no|<!-- No numerals.
-->{{#ifeq: {{lc: {{{top|yes}}} }} | no | | &nbsp;[{{fullurl: {{FULLPAGENAME}} }} Top]}}<!--
     -->|{{#ifeq:{{lc:{{{numerals|group}}}}}|separate|&nbsp;&nbsp;'''·'''&nbsp; [{{fullurl:{{FULLPAGENAME}}|from=0}} 0] [{{fullurl:{{FULLPAGENAME}}|from=1}} 1] [{{fullurl:{{FULLPAGENAME}}|from=2}} 2] [{{fullurl:{{FULLPAGENAME}}|from=3}} 3] [{{fullurl:{{FULLPAGENAME}}|from=4}} 4] [{{fullurl:{{FULLPAGENAME}}|from=5}} 5] [{{fullurl:{{FULLPAGENAME}}|from=6}} 6] [{{fullurl:{{FULLPAGENAME}}|from=7}} 7] [{{fullurl:{{FULLPAGENAME}}|from=8}} 8] [{{fullurl:{{FULLPAGENAME}}|from=9}} 9]<!-- Separate numerals.
    // Check which value "numerals" is set to. If "no", don't show anything. If "separate", show the separated number list. If anything  else, show the default "0-9" for "group".
    -->|&nbsp;&nbsp;'''·'''&nbsp; [{{fullurl:{{FULLPAGENAME}}|from=0}} 0–9]}}}}<!-- Default grouped numerals.
     // Also remove the " ·" prefix if "Top" isn't shown ("top" = "no").
-->{{#ifeq:{{lc:{{{uppercase|yes}}}}}|no||&nbsp;&nbsp;'''·'''&nbsp; [{{fullurl:{{FULLPAGENAME}}|from=A}} A] [{{fullurl:{{FULLPAGENAME}}|from=B}} B] [{{fullurl:{{FULLPAGENAME}}|from=C}} C] [{{fullurl:{{FULLPAGENAME}}|from=D}} D] [{{fullurl:{{FULLPAGENAME}}|from=E}} E] [{{fullurl:{{FULLPAGENAME}}|from=F}} F] [{{fullurl:{{FULLPAGENAME}}|from=G}} G] [{{fullurl:{{FULLPAGENAME}}|from=H}} H] [{{fullurl:{{FULLPAGENAME}}|from=I}} I] [{{fullurl:{{FULLPAGENAME}}|from=J}} J] [{{fullurl:{{FULLPAGENAME}}|from=K}} K] [{{fullurl:{{FULLPAGENAME}}|from=L}} L] [{{fullurl:{{FULLPAGENAME}}|from=M}} M] [{{fullurl:{{FULLPAGENAME}}|from=N}} N] [{{fullurl:{{FULLPAGENAME}}|from=O}} O] [{{fullurl:{{FULLPAGENAME}}|from=P}} P] [{{fullurl:{{FULLPAGENAME}}|from=Q}} Q] [{{fullurl:{{FULLPAGENAME}}|from=R}} R] [{{fullurl:{{FULLPAGENAME}}|from=S}} S] [{{fullurl:{{FULLPAGENAME}}|from=T}} T] [{{fullurl:{{FULLPAGENAME}}|from=U}} U] [{{fullurl:{{FULLPAGENAME}}|from=V}} V] [{{fullurl:{{FULLPAGENAME}}|from=W}} W] [{{fullurl:{{FULLPAGENAME}}|from=X}} X] [{{fullurl:{{FULLPAGENAME}}|from=Y}} Y] [{{fullurl:{{FULLPAGENAME}}|from=Z}} Z]}}<!--
-->{{#switch: {{lc: {{{numerals|group}}} }} | no = | separate = {{#ifeq: {{lc: {{{top|yes}}} }} | no | | &nbsp;'''·''' }}&nbsp;[{{fullurl: {{FULLPAGENAME}} | from=0}} 0] [{{fullurl: {{FULLPAGENAME}} | from=1}} 1] [{{fullurl: {{FULLPAGENAME}} | from=2}} 2] [{{fullurl: {{FULLPAGENAME}} | from=3}} 3] [{{fullurl: {{FULLPAGENAME}} | from=4}} 4] [{{fullurl: {{FULLPAGENAME}} | from=5}} 5] [{{fullurl: {{FULLPAGENAME}} | from=6}} 6] [{{fullurl: {{FULLPAGENAME}} | from=7}} 7] [{{fullurl: {{FULLPAGENAME}} | from=8}} 8] [{{fullurl: {{FULLPAGENAME}} | from=9}} 9] | #default = {{#ifeq: {{lc: {{{top|yes}}} }} | no | | &nbsp;'''·''' }}&nbsp;[{{fullurl: {{FULLPAGENAME}} | from=0}} 0–9]}}<!--
-->{{#ifeq:{{lc:{{{lowercase|no}}}}}|yes|&nbsp;&nbsp;'''·'''&nbsp;[{{fullurl:{{FULLPAGENAME}}|from=a}} a] [{{fullurl:{{FULLPAGENAME}}|from=b}} b] [{{fullurl:{{FULLPAGENAME}}|from=c}} c] [{{fullurl:{{FULLPAGENAME}}|from=d}} d] [{{fullurl:{{FULLPAGENAME}}|from=e}} e] [{{fullurl:{{FULLPAGENAME}}|from=f}} f] [{{fullurl:{{FULLPAGENAME}}|from=g}} g] [{{fullurl:{{FULLPAGENAME}}|from=h}} h] [{{fullurl:{{FULLPAGENAME}}|from=i}} i] [{{fullurl:{{FULLPAGENAME}}|from=j}} j] [{{fullurl:{{FULLPAGENAME}}|from=k}} k] [{{fullurl:{{FULLPAGENAME}}|from=l}} l] [{{fullurl:{{FULLPAGENAME}}|from=m}} m] [{{fullurl:{{FULLPAGENAME}}|from=n}} n] [{{fullurl:{{FULLPAGENAME}}|from=o}} o] [{{fullurl:{{FULLPAGENAME}}|from=p}} p] [{{fullurl:{{FULLPAGENAME}}|from=q}} q] [{{fullurl:{{FULLPAGENAME}}|from=r}} r] [{{fullurl:{{FULLPAGENAME}}|from=s}} s] [{{fullurl:{{FULLPAGENAME}}|from=t}} t] [{{fullurl:{{FULLPAGENAME}}|from=u}} u] [{{fullurl:{{FULLPAGENAME}}|from=v}} v] [{{fullurl:{{FULLPAGENAME}}|from=w}} w] [{{fullurl:{{FULLPAGENAME}}|from=x}} x] [{{fullurl:{{FULLPAGENAME}}|from=y}} y] [{{fullurl:{{FULLPAGENAME}}|from=z}} z]|}}
    // If "uppercase" is set to the default "yes" (or anything else except "no"), show the uppercase letters. Don't show anything if set to "no".
</td></tr></table><noinclude>
    // Also remove the " ·" prefix if both "top" and "numerals" aren't shown (both = "no").
 
-->{{#ifeq: {{lc: {{{uppercase|yes}}} }} | no | |{{#ifeq: {{lc: {{{numerals|group}}} }} | {{lc: {{{top|yes}}} }} | | &nbsp;'''·''' }}&nbsp;[{{fullurl: {{FULLPAGENAME}} | from=A}} A] [{{fullurl: {{FULLPAGENAME}} | from=B}} B] [{{fullurl: {{FULLPAGENAME}} | from=C}} C] [{{fullurl: {{FULLPAGENAME}} | from=D}} D] [{{fullurl: {{FULLPAGENAME}} | from=E}} E] [{{fullurl: {{FULLPAGENAME}} | from=F}} F] [{{fullurl: {{FULLPAGENAME}} | from=G}} G] [{{fullurl: {{FULLPAGENAME}} | from=H}} H] [{{fullurl: {{FULLPAGENAME}} | from=I}} I] [{{fullurl: {{FULLPAGENAME}} | from=J}} J] [{{fullurl: {{FULLPAGENAME}} | from=K}} K] [{{fullurl: {{FULLPAGENAME}} | from=L}} L] [{{fullurl: {{FULLPAGENAME}} | from=M}} M] [{{fullurl: {{FULLPAGENAME}} | from=N}} N] [{{fullurl: {{FULLPAGENAME}} | from=O}} O] [{{fullurl: {{FULLPAGENAME}} | from=P}} P] [{{fullurl: {{FULLPAGENAME}} | from=Q}} Q] [{{fullurl: {{FULLPAGENAME}} | from=R}} R] [{{fullurl: {{FULLPAGENAME}} | from=S}} S] [{{fullurl: {{FULLPAGENAME}} | from=T}} T] [{{fullurl: {{FULLPAGENAME}} | from=U}} U] [{{fullurl: {{FULLPAGENAME}} | from=V}} V] [{{fullurl: {{FULLPAGENAME}} | from=W}} W] [{{fullurl: {{FULLPAGENAME}} | from=X}} X] [{{fullurl: {{FULLPAGENAME}} | from=Y}} Y] [{{fullurl: {{FULLPAGENAME}} | from=Z}} Z]}}<!--
    // If "lowercase" is set to "yes", show the lowercase letters. Don't show anything if set to the default "no" (or anything else).
    // Also remove the " ·" prefix if "top", "numerals" and "uppercase" aren't shown (all = "no").
-->{{#ifeq: {{lc: {{{lowercase|no}}} }} | yes |{{#ifeq: {{lc: {{{top|yes}}} }} | no | {{#ifeq: {{lc: {{{uppercase|yes}}} }} | {{lc: {{{numerals|group}}} }} | | &nbsp;'''·'''}} | &nbsp;'''·'''}}&nbsp;[{{fullurl: {{FULLPAGENAME}} | from=a}} a] [{{fullurl: {{FULLPAGENAME}} | from=b}} b] [{{fullurl: {{FULLPAGENAME}} | from=c}} c] [{{fullurl: {{FULLPAGENAME}} | from=d}} d] [{{fullurl: {{FULLPAGENAME}} | from=e}} e] [{{fullurl: {{FULLPAGENAME}} | from=f}} f] [{{fullurl: {{FULLPAGENAME}} | from=g}} g] [{{fullurl: {{FULLPAGENAME}} | from=h}} h] [{{fullurl: {{FULLPAGENAME}} | from=i}} i] [{{fullurl: {{FULLPAGENAME}} | from=j}} j] [{{fullurl: {{FULLPAGENAME}} | from=k}} k] [{{fullurl: {{FULLPAGENAME}} | from=l}} l] [{{fullurl: {{FULLPAGENAME}} | from=m}} m] [{{fullurl: {{FULLPAGENAME}} | from=n}} n] [{{fullurl: {{FULLPAGENAME}} | from=o}} o] [{{fullurl: {{FULLPAGENAME}} | from=p}} p] [{{fullurl: {{FULLPAGENAME}} | from=q}} q] [{{fullurl: {{FULLPAGENAME}} | from=r}} r] [{{fullurl: {{FULLPAGENAME}} | from=s}} s] [{{fullurl: {{FULLPAGENAME}} | from=t}} t] [{{fullurl: {{FULLPAGENAME}} | from=u}} u] [{{fullurl: {{FULLPAGENAME}} | from=v}} v] [{{fullurl: {{FULLPAGENAME}} | from=w}} w] [{{fullurl: {{FULLPAGENAME}} | from=x}} x] [{{fullurl: {{FULLPAGENAME}} | from=y}} y] [{{fullurl: {{FULLPAGENAME}} | from=z}} z]}}
</td></tr></table><!--
    // If "float" is set to "yes", don't add anything. If set to the default "no" (or anything else), add a float clearing <div>.
-->{{#ifeq: {{lc: {{{float|no}}} }} | yes | | <div style="clear: both"></div>}}<noinclude>


== Template:CategoryTOC ==
== Template:CategoryTOC ==


This template is based on <span class="plainlinks">[http://www.mediawiki.org/wiki/Template:CategoryTOC Template:CategoryTOC]</span>.
This template is based on <span class="plainlinks">[http://www.mediawiki.org/wiki/Template:CategoryTOC Template:CategoryTOC]</span>.


It uses the original markup. The documentation below was copied to this template, since we do not use [[Wikipedia:Wikipedia:Template_documentation#How_to_create_a_documentation_subpage | documentation sub-pages]]. <span class="plainlinks">[http://www.mediawiki.org/wiki/MediaWiki MediaWiki]</span> specific information, links and sub-templates have either been removed, or modified for the Avlis wiki. It has been reformatted, and modified for improved clarity.
It uses a modified version of the original markup, with various improvements and fixes. The documentation below was copied to this template, since we do not use [[Wikipedia:Wikipedia:Template_documentation#How_to_create_a_documentation_subpage | documentation sub-pages]]. <span class="plainlinks">[http://www.mediawiki.org/wiki/MediaWiki MediaWiki]</span> specific information, links and sub-templates have either been removed, or modified for the Avlis wiki. It has been reformatted, and modified for current usage with improved clarity.


See the <span class="plainlinks">[http://www.mediawiki.org/wiki/Template:CategoryTOC/doc original template documentation]</span> for further details.
See the <span class="plainlinks">[http://www.mediawiki.org/wiki/Template:CategoryTOC/doc original template documentation]</span> for further details.


== Template documentation ==
== Template documentation ==


This template adds a table of contents (TOC) to a category page. It should ''only'' be added to category pages. It is generally not used for categories containing less than 200 total pages.
This template adds a horizontal ''alphanumeric'' table of contents (TOC) to a category page. It should ''only'' be added to category pages. It is generally used for categories containing at least 200 total pages.
 


=== Usage ===
=== Usage ===
Line 33: Line 46:
  | uppercase = yes / no
  | uppercase = yes / no
  | lowercase = no / yes
  | lowercase = no / yes
| float    = no / yes
}}
}}
</pre>
</pre>


=== Parameters ===
=== Parameters ===


*<code>'''align'''</code> - Specifies the position. Default is <code>center</code>:
 
**<code>center</code> (default)
<code>'''align'''</code> - Specifies the position. Default is <code>center</code>:
**<code>left</code>
*<code>center</code> (default)
**<code>right</code>
*<code>left</code>
*<code>'''top'''</code> - Specifies whether a link to the top of the category is included. Default is <code>yes</code>:
*<code>right</code>
**<code>yes</code> (default)
 
**<code>no</code>
 
*<code>'''numerals'''</code> - Specifies whether numerals are included Default is <code>group</code>:
<code>'''top'''</code> - Specifies if a link to the top of the category is included. Default is <code>yes</code>:
**<code>group</code> (default): There is one link for 0-9.
*<code>yes</code> (default)
**<code>separate</code>: Each numeral 0,1,...,9 has a separate link.
*<code>no</code>
**<code>no</code>: No numeral link.
 
*<code>'''uppercase'''</code> - Specifies whether there is a link for each uppercase letter A,B,...,Z. Default is <code>yes</code>:
 
**<code>yes</code> (default)
<code>'''numerals'''</code> - Specifies if numerals are included Default is <code>group</code>:
**<code>no</code>
*<code>group</code> (default): There is one link for 0-9.
*<code>'''lowercase'''</code> - Specifies whether there is a link for each lowercase letter a,b,...,z. Default is <code>no</code>:
*<code>separate</code>: Each numeral 0, 1, ..., 9 has a separate link.
**<code>no</code> (default)
*<code>no</code>: No numeral link.
**<code>yes</code>
 
 
<code>'''uppercase'''</code> - Specifies if a link for each uppercase letter (A, B, ..., Z) is included. Default is <code>yes</code>:
*<code>yes</code> (default)
*<code>no</code>
 
 
<code>'''lowercase'''</code> - Specifies if a link for each lowercase letter (a, b, ..., z) is included. Default is <code>no</code>:
*<code>no</code> (default)
*<code>yes</code>
 
 
<code>'''float'''</code> - This specifies if the TOC should float around the next element (the default <code>'''align''' = center</code> does not float). See [[#Notes | Notes]] for more details. Default is <code>no</code>:
*<code>no</code> (default)
*<code>yes</code>
 
 
=== Notes ===
 
* Parameter ''values'' in this template are not case sensitive, so either uppercase or lowercase ''values'' will work,
** Parameter ''names'' '''are''' case sensitive, and '''always lowercase'''!
 
 
* The MediaWiki version of <span class="plainlinks">[http://www.mediawiki.org/wiki/Template:CategoryTOC Template:CategoryTOC]</span> (what this is based on), will float around the next element (usually the first Subcategories header) when <code>'''align''' = left</code> or <code>'''align''' = right</code> are used. While this adds more flexibility to category page design, it also means basic usage requires adding some method to clear the float. The Wikipedia version of [[Wikipedia:Template:Category_TOC | Category TOC]] does not float, since this can easily be added to a floating container element instead.
 
: Rather than forcing users to do it one way or the other, this template has an extra <code>'''float'''</code> parameter. The default value is <code>no</code> (like Wikipedia's version that doesn't float), and setting the value to <code>yes</code> will restore floating (the behavior of MediaWiki's version). This is primarily a convenience option, so that basic usage doesn't require extra markup, without losing the original float functionality. As mentioned, a simple container element can be used to make this float as well (with more options), so using the <code>'''float'''</code> parameter is entirely optional.


{{ns detect | template = [[Category:Templates |{{PAGENAME}}]] }}</noinclude>
{{ns detect | template = [[Category:Templates |{{PAGENAME}}]] }}</noinclude>

Revision as of 15:05, 6 February 2017

This is a user sandbox of Gorgon. A user sandbox is a subpage of the user's user page. It serves as a testing spot and page development space for the user, and is not an Avlis wiki article.



Template:CategoryTOC

This template is based on Template:CategoryTOC.

It uses a modified version of the original markup, with various improvements and fixes. The documentation below was copied to this template, since we do not use documentation sub-pages. MediaWiki specific information, links and sub-templates have either been removed, or modified for the Avlis wiki. It has been reformatted, and modified for current usage with improved clarity.

See the original template documentation for further details.


Template documentation

This template adds a horizontal alphanumeric table of contents (TOC) to a category page. It should only be added to category pages. It is generally used for categories containing at least 200 total pages.


Usage

{{CategoryTOC
 | align     = center / left / right
 | top       = yes / no
 | numerals  = group / separate / no
 | uppercase = yes / no
 | lowercase = no / yes
 | float     = no / yes
}}


Parameters

align - Specifies the position. Default is center:

  • center (default)
  • left
  • right


top - Specifies if a link to the top of the category is included. Default is yes:

  • yes (default)
  • no


numerals - Specifies if numerals are included Default is group:

  • group (default): There is one link for 0-9.
  • separate: Each numeral 0, 1, ..., 9 has a separate link.
  • no: No numeral link.


uppercase - Specifies if a link for each uppercase letter (A, B, ..., Z) is included. Default is yes:

  • yes (default)
  • no


lowercase - Specifies if a link for each lowercase letter (a, b, ..., z) is included. Default is no:

  • no (default)
  • yes


float - This specifies if the TOC should float around the next element (the default align = center does not float). See Notes for more details. Default is no:

  • no (default)
  • yes


Notes

  • Parameter values in this template are not case sensitive, so either uppercase or lowercase values will work,
    • Parameter names are case sensitive, and always lowercase!


  • The MediaWiki version of Template:CategoryTOC (what this is based on), will float around the next element (usually the first Subcategories header) when align = left or align = right are used. While this adds more flexibility to category page design, it also means basic usage requires adding some method to clear the float. The Wikipedia version of Category TOC does not float, since this can easily be added to a floating container element instead.
Rather than forcing users to do it one way or the other, this template has an extra float parameter. The default value is no (like Wikipedia's version that doesn't float), and setting the value to yes will restore floating (the behavior of MediaWiki's version). This is primarily a convenience option, so that basic usage doesn't require extra markup, without losing the original float functionality. As mentioned, a simple container element can be used to make this float as well (with more options), so using the float parameter is entirely optional.