Difference between revisions of "Template:Collapsible lists option"

From blackwiki
Jump to navigation Jump to search
(Added error message when "listnames" not provided)
imported>Sardanaphalus
(restricted bold to the key list of names, layout simplification, some rephrasing)
Line 1: Line 1:
* This template includes {{tl|collapsible list}}s. <!--
+
* This template includes {{tl|collapsible list}}s.
 +
: By default, all lists have been set to be <!--
 +
  -->{{#ifeq:{{{expanded<includeonly>|</includeonly>}}}|all
 +
      | shown.
 +
      | hidden. <!----To show all lists:----> To have all lists shown,
 +
:: use <code class="nowrap">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}expanded=all{{))}}</code>
 +
:: (or, if enabled, <code class="nowrap">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}all{{))}}</code>, i.e. without the "expanded=").
 +
      }}
  
      --------- Different texts depending on template's default state ---------
+
  <!------------- To show a particular list --------------->
  -->By default, all lists are <!--
+
: To have one particular list shown while the others remain hidden, use <code class="nowrap">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}expanded=''listname''}}</code> (or, if enabled, <code class="nowrap">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}''listname''}}</code>&nbsp;),
  -->{{#ifeq:{{{expanded<includeonly>|</includeonly>}}}|all
+
: where ''listname'' is one of the following:
      |expanded.
+
:: <code style="font-size:110%;font-weight:bold;">{{{listnames<includeonly>|{{color|red|''Required parameter "listnames" missing!''}}</includeonly>}}}</code>
      |collapsed.<!--
+
: (do not include any quotemarks).
  
      --------------------- To show all lists expanded ------------------------
+
  <!---------- If an example has been included ------------>
      --><div style="padding-bottom:0.75em;"><!--
+
{{#if:{{{example<includeonly>|</includeonly>}}} |
          -->To show all lists expanded, use <code style="white-space:nowrap;font-weight:bold;">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> <nowiki>|expanded=all}}</nowiki></code> <br/><!--
+
: <noinclude>{{resize|90%|[''optional example:'']&nbsp;}}</noinclude> For example, <code class="nowrap">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}expanded={{{example}}}{{))}}</code> (or, if enabled, <code class="nowrap">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}{{{example}}}{{))}}</code>&nbsp;).
          --><span style="font-size:100%;">(or, if enabled, <code style="white-space:nowrap;">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> <nowiki>|all}}</nowiki></code>, i.e. without the "expanded=")</span>.<!--
+
}}<noinclude>
      --></div><!--
 
  -->}}<!--
 
  
      --------------------- To show a particular list -------------------------
 
      --><div style="padding-bottom:0.75em;"><!--
 
      -->To show one particular list expanded while the others remain collapsed, <br/><!--
 
      -->use <code style="white-space:nowrap;font-weight:bold;">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}expanded=''listname''}}</code> <span style="font-size:100%;">(or, if enabled, <code style="white-space:nowrap;">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}''listname''}}</code>&nbsp;)</span> <br/><!--
 
      -->where ''listname'' is one of the following: <div style="padding:0.25em 0;"><code style="font-size:110%;font-weight:bold;">{{{listnames<includeonly>|{{color|red|''Required parameter "listnames" missing!''}}</includeonly>}}}</code></div><!--
 
      -->(do not include any quotemarks).<!--
 
      --></div><!--
 
 
      ------------------- If an example has been included ---------------------
 
      -->{{#if:{{{example<includeonly>|</includeonly>}}}
 
          | <noinclude>[</noinclude> For example, <code style="white-space:nowrap;">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}expanded={{{example}}}{{))}}</code> <br/><!--
 
          --><noinclude>{{nbsp|2}}</noinclude><span style="font-size:100%;">(or, if enabled, <code style="white-space:nowrap;">{{((}}<noinclude>''Template name''</noinclude><includeonly>{{PAGENAME}}</includeonly> {{!}}{{{example}}}{{))}}</code>&nbsp;)</span>.<!--
 
      -->}} <noinclude>]
 
 
{{documentation}}
 
{{documentation}}
 
<!-- Please add this template's categories to the /doc subpage - thanks! -->
 
<!-- Please add this template's categories to the /doc subpage - thanks! -->
 
</noinclude>
 
</noinclude>

Revision as of 12:34, 5 April 2014

By default, all lists have been set to be hidden. To have all lists shown,
use {{Template name |expanded=all}}
(or, if enabled, {{Template name |all}}, i.e. without the "expanded=").
To have one particular list shown while the others remain hidden, use {{Template name |expanded=listname}} (or, if enabled, {{Template name |listname}} ),
where listname is one of the following:
{{{listnames}}}
(do not include any quotemarks).
[optional example: For example, {{Template name |expanded={{{example}}}}} (or, if enabled, {{Template name |{{{example}}}}} ).
Template documentation[view] [edit] [history] [purge]
  • When this template is transcluded, the texts within square brackets will either not appear or be replaced accordingly.

Usage

{{Collapsible lists option
| expandedname =  <!--(see below)-->
| listnames =
| example =       <!--(one of the listnames)-->
| default =       <!--("all" or a listname, if either set to be shown)-->
}}

Parameters expandedname, example and default are optional. If the template featuring the collapsible lists already makes use of its first unnamed parameter – see, for example, {{Labor}} – use |expandedname=required with {{Collapsible lists option}} (i.e. {{Collapsible lists option |expandedname=required |…}}) to suppress the "or, if enabled, …" portions of the text above.

See also