The editors' meeting has been canceled for technical reasons.
Template:Hide: Difference between revisions
m 1 revision imported |
No edit summary |
||
Line 1: | Line 1: | ||
<includeonly><table class="mw-collapsible {{#ifeq:{{#switch:show|{{{show|}}}|{{{1|}}}=true|#default=false}}|true||mw-collapsed}} wikitable" {{#if:{{{width|}}}|style="width: {{{width}}}"}} {{#if:{{{expandtext|}}}|data-expandtext="{{{expandtext}}}"|}} {{#if:{{{collapsetext|}}}|data-collapsetext="{{{collapsetext}}}"|}}> | <includeonly><table class="mw-collapsible {{#ifeq:{{#switch:show|{{{show|}}}|{{{1|}}}=true|#default=false}}|true||mw-collapsed}} wikitable" {{#if:{{{width|}}}|style="width: {{{width}}}"}} {{#if:{{{expandtext|}}}|data-expandtext="{{{expandtext}}}"|}} {{#if:{{{collapsetext|}}}|data-collapsetext="{{{collapsetext}}}"|}}> | ||
<tr> | <tr> | ||
<th>{{{title|{{{ | <th>{{{title|{{{Title|{{{TITLE|{{#ifeq:{{{1}}}|show|{{{2|}}}|{{{1|}}}}}}}}}}}}}}</th> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td> | ||
{{{text|{{{ | {{{text|{{{Content|{{{CONTENT|{{#ifeq:{{{1}}}|show|{{{3|}}}|{{{2|}}}}}}}}}}}}}} | ||
</td> | </td> | ||
</tr> | </tr> | ||
</table></includeonly><noinclude>{{Documentation}}[[ | </table></includeonly><noinclude>{{Documentation}}[[zh:Template:Hide]][[Category:Functional Templates]]</noinclude> |
Latest revision as of 23:11, 12 January 2025
This template is used to hide a section of text, images, or tables and add a title.
Usage
Parameter Name | Description |
---|---|
show | When this parameter is set to show , the content will be expanded by default.
|
title | The title section of the table. |
content | The content section of the table. |
width | Specifies the width of the table. |
expandtext | Custom text for "Expand." |
collapsetext | Custom text for "Collapse." |
Some parameters can omit the parameter name, following these rules:
- If the first unnamed parameter value is
show
, the content will be expanded by default:- If there is no
title
parameter, the second unnamed parameter will be used as the title. - If there is no
content
parameter, the third unnamed parameter will be used as the content.
- If there is no
- If the first unnamed parameter is not
show
:- If there is no
title
parameter, the first unnamed parameter will be used as the title. - If there is no
content
parameter, the second unnamed parameter will be used as the content.
- If there is no
Examples
Basic Example
{{Hide|Example Title|*Test|expandtext=Really want to see?|collapsetext=Nothing here}}
Example Title |
---|
|
Image Example
{{Hide|File:Turtle_emoji.png|[[File:Turtle_emoji.png]]}}
File:Turtle_emoji.png |
---|
{{Hide|[[File:Turtle_emoji.png]]|File:Turtle_emoji.png}}
![]() |
---|
File:Turtle_emoji.png |
"show" Parameter Example
{{Hide |title=File:Turtle_emoji.png |content= [[File:Turtle_emoji.png]] |show=show }}
File:Turtle_emoji.png |
---|
{{hide |title=Example |content=Automatically shows hide template |show }}
Example |
---|
- Both
|show=show
and|show
will automatically display hidden content, while|show=
will not. (Note the equal sign after the show parameter.)
Notes
Tables Inside the Template
Using wiki tables directly inside this template may cause errors because the vertical bar |
in tables is mistakenly recognized as a parameter separator (e.g., {{Hide||-}} will be interpreted as {{Hide| (no parameter) | (parameter: -) }}).
Solution 1: Replace |
in the table with {{!}}
and replace ||
with {{!!}}
.
Solution 2: Do not use {{hide}}. Instead, add class="mw-collapsible mw-collapsed wikitable"
to the table manually:
{| class="mw-collapsible mw-collapsed wikitable" |- ! Skill Name !! Effect |- | '''Tocca''' || Ribbon attack in "Fighting" with a chance to cause "Bind" status. |- | '''Tocca·Spirale''' || Spiral ribbon attack with penetration effect in "Fighting." |- ......
Result: Example Page#Skill List
Using Template with Indentation or Lists
Using this template with indentation (:
) or lists (*
, #
) may cause display errors, such as interrupted lists or improper indentation. In such cases, use {{HideInline}} or {{Hid}}, or place {{Hide}} on a new line. For example:
Incorrect Example
: John{{Hide|content=Jane}}Doe * John{{Hide|content=Jane}}Doe
Correct Example
Using {{Hide}} | Using {{HideInline}} | Using {{Hid}} | ||
---|---|---|---|---|
* John {{Hide|content=Jane}} * Doe
|
* John{{HideInline|content=Jane}}Doe
|
* John {{Hid|inline=1|content=Jane}} Doe * John : {{Hid|content=Jane}} * John{{Hid|content=Jane}}Doe * Doe
|