The editors' meeting has been canceled for technical reasons.
Template:Hide/doc: Difference between revisions
m 1 revision imported |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
This template is used to hide a section of text, images, or tables and add a title. | |||
== | == Usage == | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ Parameter List | ||
|- | |- | ||
! | ! Parameter Name | ||
! | ! Description | ||
|- | |- | ||
| style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | show | | style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | show | ||
| | | When this parameter is set to <code>show</code>, the content will be expanded by default. | ||
|- | |- | ||
| style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | | | style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | title | ||
| | | The title section of the table. | ||
|- | |- | ||
| style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | | | style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | content | ||
| | | The content section of the table. | ||
|- | |- | ||
| style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | width | | style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | width | ||
| | | Specifies the width of the table. | ||
|- | |- | ||
| style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | expandtext | | style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | expandtext | ||
| | | Custom text for "Expand." | ||
|- | |- | ||
| style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | collapsetext | | style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | collapsetext | ||
| | | Custom text for "Collapse." | ||
|} | |} | ||
Some parameters can omit the parameter name, following these rules: | |||
* | * If the first unnamed parameter value is <code>show</code>, the content will be expanded by default: | ||
*# | *# If there is no <code>title</code> parameter, the second unnamed parameter will be used as the title. | ||
*# | *# If there is no <code>content</code> parameter, the third unnamed parameter will be used as the content. | ||
* | * If the first unnamed parameter is '''not''' <code>show</code>: | ||
*# | *# If there is no <code>title</code> parameter, the first unnamed parameter will be used as the title. | ||
*# | *# If there is no <code>content</code> parameter, the second unnamed parameter will be used as the content. | ||
== | == Examples == | ||
=== | === Basic Example === | ||
<pre class="prettyprint linenums lang-wiki"> | <pre class="prettyprint linenums lang-wiki"> | ||
{{Hide| | {{Hide|Example Title|*Test|expandtext=Really want to see?|collapsetext=Nothing here}} | ||
</pre> | </pre> | ||
{{Hide| | {{Hide|Example Title|*Test|expandtext=Really want to see?|collapsetext=Nothing here}} | ||
=== | === Image Example === | ||
<pre class="prettyprint linenums lang-wiki"> | <pre class="prettyprint linenums lang-wiki"> | ||
{{Hide|File:Turtle_emoji.png|[[File:Turtle_emoji.png]]}} | {{Hide|File:Turtle_emoji.png|[[File:Turtle_emoji.png]]}} | ||
Line 51: | Line 51: | ||
{{Hide|[[File:Turtle_emoji.png]]|File:Turtle_emoji.png}} | {{Hide|[[File:Turtle_emoji.png]]|File:Turtle_emoji.png}} | ||
=== | === "show" Parameter Example === | ||
<pre class="prettyprint linenums lang-wiki"> | <pre class="prettyprint linenums lang-wiki"> | ||
{{Hide | {{Hide | ||
| | |title=File:Turtle_emoji.png | ||
| | |content= | ||
[[File:Turtle_emoji.png]] | [[File:Turtle_emoji.png]] | ||
|show=show | |show=show | ||
Line 61: | Line 61: | ||
</pre> | </pre> | ||
{{Hide | {{Hide | ||
| | |title=File:Turtle_emoji.png | ||
| | |content= | ||
[[File:Turtle_emoji.png]] | [[File:Turtle_emoji.png]] | ||
|show=show | |show=show | ||
}} | }} | ||
<pre class="prettyprint linenums lang-wiki"> | <pre class="prettyprint linenums lang-wiki"> | ||
{{hide | {{hide | ||
| | |title=Example | ||
| | |content=Automatically shows hide template | ||
|show | |show | ||
}} | }} | ||
</pre> | </pre> | ||
{{hide | {{hide | ||
| | |title=Example | ||
| | |content=Automatically shows hide template | ||
|show | |show | ||
}} | }} | ||
* | * Both <code>|show=''show''</code> and <code>|show</code> will automatically display hidden content, while <code>|show=</code> 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 <code>|</code> in tables is mistakenly recognized as a parameter separator (e.g., <nowiki>{{Hide||-}}</nowiki> will be interpreted as <nowiki>{{Hide| (no parameter) | (parameter: -) }}</nowiki>). | |||
Solution 1: Replace <code>|</code> in the table with <code><nowiki>{{!}}</nowiki></code> and replace <code>||</code> with <code><nowiki>{{!!}}</nowiki></code>. | |||
Solution 2: Do not use {{tl|hide}}. Instead, add <code>class="mw-collapsible mw-collapsed wikitable"</code> to the table manually: | |||
<pre class="prettyprint linenums lang-wiki"> | |||
<pre class="prettyprint linenums lang-wiki"> | |||
{| class="mw-collapsible mw-collapsed wikitable" | {| class="mw-collapsible mw-collapsed wikitable" | ||
|- | |- | ||
! | ! Skill Name !! Effect | ||
|- | |- | ||
| '''Tocca''' || | | '''Tocca''' || Ribbon attack in "Fighting" with a chance to cause "Bind" status. | ||
|- | |- | ||
| ''' | | '''Tocca·Spirale''' || Spiral ribbon attack with penetration effect in "Fighting." | ||
|- | |- | ||
...... | ...... | ||
</pre> | </pre> | ||
Result: [[Example Page#Skill List]] | |||
=== | === Using Template with Indentation or Lists === | ||
Using this template with indentation (<code>:</code>) or lists (<code>*</code>, <code>#</code>) may cause display errors, such as interrupted lists or improper indentation. In such cases, use {{tl|HideInline}} or {{tl|Hid}}, or place {{tl|Hide}} on a new line. For example: | |||
<big>''' | <big>'''Incorrect Example'''</big> | ||
<pre class="prettyprint linenums lang-wiki"> | |||
<pre class="prettyprint linenums lang-wiki"> | : John{{Hide|content=Jane}}Doe | ||
: | * John{{Hide|content=Jane}}Doe | ||
* | |||
</pre> | </pre> | ||
<big>''' | <big>'''Correct Example'''</big> | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! | ! Using {{tl|Hide}} | ||
! | ! Using {{tl|HideInline}} | ||
! | ! Using {{tl|Hid}} | ||
|- | |- | ||
| style="min-width:15em;vertical-align:top;" | | | style="min-width:15em;vertical-align:top;" | | ||
<pre class="prettyprint linenums lang-wiki"> | <pre class="prettyprint linenums lang-wiki"> | ||
* | * John | ||
{{Hide| | {{Hide|content=Jane}} | ||
* | * Doe | ||
</pre> | </pre> | ||
* | * John | ||
{{Hide| | {{Hide|content=Jane}} | ||
* | * Doe | ||
| style="min-width:15em;vertical-align:top;" | | | style="min-width:15em;vertical-align:top;" | | ||
<pre class="prettyprint linenums lang-wiki"> | <pre class="prettyprint linenums lang-wiki"> | ||
* | * John{{HideInline|content=Jane}}Doe | ||
</pre> | </pre> | ||
* | * John{{HideInline|content=Jane}}Doe | ||
| style="min-width:15em;vertical-align:top;" | | | style="min-width:15em;vertical-align:top;" | | ||
<pre class="prettyprint linenums lang-wiki"> | <pre class="prettyprint linenums lang-wiki"> | ||
* | * John {{Hid|inline=1|content=Jane}} Doe | ||
* | * John | ||
: {{Hid| | : {{Hid|content=Jane}} | ||
* | * John{{Hid|content=Jane}}Doe | ||
* | * Doe | ||
</pre> | </pre> | ||
* | * John {{Hid|inline=1|content=Jane}} Doe | ||
* | * John | ||
: {{Hid| | : {{Hid|content=Jane}} | ||
* | * John{{Hid|content=Jane}}Doe | ||
* | * Doe | ||
|} | |} | ||
== | == Others == | ||
*[[Help: | *[[Help:Collapsible]] | ||
<noinclude>[[Category: | <noinclude>[[zh:Template:Hide/doc]][[Category:Template Documentation]]</noinclude> |
Latest revision as of 23:09, 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
|