The editors' meeting has been canceled for technical reasons.

Template:Hide/doc: Difference between revisions

From NeuroWiki
Jump to navigation Jump to search
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
| 当该参数内容为<code>show</code>时,将会默认展开内容
| 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:
* 若第1个无名参数值为<code>show</code>时,将会默认展开内容:
* If the first unnamed parameter value is <code>show</code>, the content will be expanded by default:
*# 此时若没有参数<code>标题</code>,则将会使用第'''''2'''''个无名参数值为标题部分;
*# If there is no <code>title</code> parameter, the second unnamed parameter will be used as the title.
*# 此时若没有参数<code>内容</code>,则将会使用第'''''3'''''个无名参数值为内容部分;
*# If there is no <code>content</code> parameter, the third unnamed parameter will be used as the content.
* 若第1个无名参数值''''''<code>show</code>时:
* If the first unnamed parameter is '''not''' <code>show</code>:
*# 此时若没有参数<code>标题</code>,则将会使用第'''''1'''''个无名参数值为标题部分;
*# If there is no <code>title</code> parameter, the first unnamed parameter will be used as the title.
*# 此时若没有参数<code>内容</code>,则将会使用第'''''2'''''个无名参数值为内容部分。
*# 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|河蟹你懂的|*测试|expandtext=-{真的要看吗?}-|collapsetext=-{其实什么也没有}-}}
{{Hide|Example Title|*Test|expandtext=Really want to see?|collapsetext=Nothing here}}
</pre>
</pre>
{{Hide|河蟹你懂的|*测试|expandtext=真的要看吗?|collapsetext=其实什么也没有}}
{{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”参数示例 ===
=== "show" Parameter Example ===
<pre class="prettyprint linenums lang-wiki">-{}-
<pre class="prettyprint linenums lang-wiki">
{{Hide
{{Hide
|标题=File:Turtle_emoji.png
|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
|标题=File:Turtle_emoji.png
|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
|内容=自动显示hide模板
|content=Automatically shows hide template
|show
|show
}}
}}
</pre>
</pre>
{{hide
{{hide
|标题=示例
|title=Example
|内容=自动显示hide模板
|content=Automatically shows hide template
|show
|show
}}
}}


* 综上,在模板中使用<code>|show=''show''</code>或是<code>|show</code>中的任意一种,都会自动显示隐藏内容,而<code>|show=</code>的写法不会自动显示。(注意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 ===
本模板里面直接使用维基表格会出现错误,出错原因是维基表格中的竖线<code>|</code>被错误识别为参数的分割线(比如<nowiki>{{Hide||-}}</nowiki>会被识别为<nowiki>{{Hide|(无参数)|(参数:-}}</nowiki>。)
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>).


解决方案一:请使用<code><nowiki>{{!}}</nowiki></code>代替表格中的<code>|</code><code><nowiki>{{!!}}</nowiki></code>代替表格中的<code>||</code>。
Solution 1: Replace <code>|</code> in the table with <code><nowiki>{{!}}</nowiki></code> and replace <code>||</code> with <code><nowiki>{{!!}}</nowiki></code>.


解决方案二:不使用{{tl|hide}},直接手动在表格加入<code>class="mw-collapsible mw-collapsed wikitable"</code><br>
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·Splrale''' || 《格斗》使缎带化为螺旋状,对前方进行贯通攻击
| '''Tocca·Spirale''' || Spiral ribbon attack with penetration effect in "Fighting."
|-
|-
......
......
</pre>
</pre>
效果如下:[[巴麻美#PSP版技能]]
Result: [[Example Page#Skill List]]


=== 模板与缩进、列表同时使用 ===
=== Using Template with Indentation or Lists ===
本模板与表示缩进的“<code>:</code>”或表示列表的“<code>*</code>”“<code>#</code>”连用时会出现显示错误,包括但不仅限于缩进无法正常结束、列表被中断等。在此种情况下,请使用{{tl|HideInline}}{{tl|Hid}}模板代替,或将{{tl|Hide}}模板另起一行。例如:
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>
<big>'''Incorrect Example'''</big>
 
<pre class="prettyprint linenums lang-wiki">
<pre class="prettyprint linenums lang-wiki">-{}-
: John{{Hide|content=Jane}}Doe
: 张三{{Hide|内容=李四}}王五
* John{{Hide|content=Jane}}Doe
* 张三{{Hide|内容=李四}}王五
</pre>
</pre>


<big>'''正确示例'''</big>
<big>'''Correct Example'''</big>
{| class="wikitable"
{| class="wikitable"
|-
|-
! 使用{{tl|Hide}}
! Using {{tl|Hide}}
! 使用{{tl|HideInline}}
! Using {{tl|HideInline}}
! 使用{{tl|Hid}}
! 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">
* 张三{{HideInline|内容=李四}}王五
* John{{HideInline|content=Jane}}Doe
</pre>
</pre>
* 张三{{HideInline|内容=李四}}王五
* 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">
* 张三&amp;nbsp;{{Hid|inline=1|内容=李四}}&amp;nbsp;王五
* John&nbsp;{{Hid|inline=1|content=Jane}}&nbsp;Doe
* 张三
* John
: {{Hid|内容=李四}}
: {{Hid|content=Jane}}
* 张三{{Hid|内容=李四}}王五
* John{{Hid|content=Jane}}Doe
* 王五
* Doe
</pre>
</pre>
* 张三&nbsp;{{Hid|inline=1|内容=李四}}&nbsp;王五
* John&nbsp;{{Hid|inline=1|content=Jane}}&nbsp;Doe
* 张三
* John
: {{Hid|内容=李四}}
: {{Hid|content=Jane}}
* 张三{{Hid|内容=李四}}王五
* John{{Hid|content=Jane}}Doe
* 王五
* Doe
|}
|}


== 其他 ==
== Others ==
*[[Help:折叠]]
*[[Help:Collapsible]]
<noinclude>[[Category:模板文档]]</noinclude>
<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 List
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:
    1. If there is no title parameter, the second unnamed parameter will be used as the title.
    2. If there is no content parameter, the third unnamed parameter will be used as the content.
  • If the first unnamed parameter is not show:
    1. If there is no title parameter, the first unnamed parameter will be used as the title.
    2. If there is no content parameter, the second unnamed parameter will be used as the content.

Examples

Basic Example

{{Hide|Example Title|*Test|expandtext=Really want to see?|collapsetext=Nothing here}}
Example Title
  • Test

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
  • Doe
* John{{HideInline|content=Jane}}Doe
  • JohnDoe
* John {{Hid|inline=1|content=Jane}} Doe
* John
: {{Hid|content=Jane}}
* John{{Hid|content=Jane}}Doe
* Doe
Template:Hid

Others