Difference between revisions of "Template:Hidden begin"

From Flexible Survival
Jump to: navigation, search
m (Removed newlines)
(Adjustments to make left-aligned toggles work)
Line 1: Line 1:
<includeonly><div class="mw-collapsible {{#ifeq:{{{showhide|}}}{{{toggle|}}}|left|mw-collapsible-leftside-toggle}} {{#if:{{{expanded|}}} | |mw-collapsed}} {{{class|}}}" style="box-sizing:border-box;width:100%;font-size:95%;padding:4px;border:{{{border|none}}};{{{style|}}}"><!--
+
<includeonly><div class="mw-collapsible {{#ifeq:{{{showhide|}}}{{{toggle|}}}|left|mw-content-rtl}} {{#if:{{{expanded|}}} | |mw-collapsed}} {{{class|}}}" style="box-sizing:border-box;width:100%;font-size:95%;padding:4px;border:{{{border|none}}};{{{style|}}}"><!--
           --><div style="font-size:100%;line-height:1.6;font-weight:bold;background:{{{bg1|transparent}}};text-align:{{{ta1|left}}};{{{extra1|}}};{{{titlestyle|{{{headercss|}}}}}}">{{{header|}}}{{{title|}}}</div><!--
+
           --><div style="font-size:100%;line-height:1.6;font-weight:bold;background:{{{bg1|transparent}}};text-align:{{{ta1|left}}};{{{extra1|}}};{{{titlestyle|{{{headercss|}}{{#ifeq:{{{showhide|}}}{{{toggle|}}}|left|;padding-left:9ex}}}}}}">{{{header|}}}{{{title|}}}</div><!--
           --><div class="mw-collapsible-content" style="background:{{{bg2|transparent}}};text-align:{{{ta2|left}}};{{{extra2|}}};{{{bodystyle|{{{contentstyle|{{{contentcss|}}}}}}}}}"></includeonly><noinclude>{{Template:Hidden begin/doc}}</noinclude>
+
           --><div class="mw-collapsible-content" style="background:{{{bg2|transparent}}};text-align:{{{ta2|left}}};{{{extra2|}}};{{{bodystyle|{{{contentstyle|{{{contentcss|}}}}}}}}}{{#ifeq:{{{showhide|}}}{{{toggle|}}}|left|;padding-left:9ex}}}}}}"></includeonly><noinclude>{{Template:Hidden begin/doc}}</noinclude>

Revision as of 22:37, 1 October 2018

Template Origin

Template and documentation copied from https://en.wikiversity.org/wiki/Template:Hidden_begin and https://en.wikiversity.org/wiki/Template:Hidden_begin/doc

Syntax

{{Hidden begin
|toggle=
|border=
|header=
|title=
|titlestyle=
|bodystyle=
|bg1=
|bg2=
|ta1=
|ta2=
|extra1=
|extra2=
}}
<!-- content -->
{{Hidden end}}

Parameters

Parameter Description
toggle Set to "left" (without speechmarks) to move [show/hide] button to titlebar's lefthand side.
title Text shown in titlebar.
titlestyle CSS styles to apply to title, e.g. "border:1px solid lightgrey;" to produce a border around the titlebar, "background:color;" to change the titlebar's background color from transparent to color, "text-align:[center/right];" to change the titlebar text's alignment from left to center or right, etc.
bodystyle CSS styles to apply to the hidden material, e.g. background and text-align per titlestyle.

Examples

Code Result
{{hidden begin
|title = default example
}}
*def
*ghi
{{hidden end}}
default example
  • def
  • ghi
{{hidden begin
|title = title with background:pink
|titlestyle = background:pink;
}}
*def
*ghi
{{hidden end}}
title with background:pink
  • def
  • ghi
{{hidden begin
|title = title aligned in the center
|titlestyle = background:pink; text-align:center;
}}
*def
*ghi{{hidden end}}
title aligned in the center
  • def
  • ghi
{{hidden begin
|title = title aligned on the right needs padding-right
|titlestyle = background:pink;
 text-align:right;padding-right:3em;
}}
*change window width and
*watch title alignment{{hidden end}}
title aligned on the right needs padding-right
  • change window width and
  • watch title alignment
{{hidden begin
|toggle     = left
|title      = title with toggle=left
|titlestyle = background:palegreen;
}}
*def
*ghi
{{hidden end}}
title with toggle=left
  • def
  • ghi
{{hidden begin
|toggle     = right
|title      = title with toggle=right
|titlestyle = background:lightgrey;
}}
*def
*ghi
{{hidden end}}
title with toggle=right
  • def
  • ghi
{{hidden begin
|toggle     = left
|title      = abc with toggle=left
|titlestyle = background:palegreen;
|bodystyle  = font-size:150%; font-weight:bold; 
}}
*def
*ghi
{{hidden end}}
abc with toggle=left
  • def
  • ghi
{{hidden begin
|toggle     = right
|header     = deprecated_header_
|title      = title with toggle=right
|titlestyle = font-style:italic; padding-right:3em;
|border     = dashed
|bg1        = palegreen
|bg2        = cyan
|ta1        = left
|ta2        = center
|extra1     = font-size:120%
|extra2     = font-size:150%
}}
*make window narrower and
*title will wrap
{{hidden end}}
deprecated_header_title with toggle=right
  • make window narrower and
  • title will wrap
{{hidden begin
|toggle     = right
|title      = title with non-breaking spaces
|titlestyle = 
|border     = dotted
|bg1        = cyan
|bg2        = yellow
|ta1        = right
|ta2        = left
|extra1     = font-size:120%; padding-right:2.5em;
|extra2     = font-size:150%; padding-left:3em;
}}
*def these should have left padding 
*ghi
{{hidden end}}
title with non-breaking spaces
  • def these should have left padding
  • ghi