Template:Hide/doc: Difference between revisions

创建页面,内容为“本模板用于隐藏一段文字/图片/表格并为其添加标题。 ==使用方法== {| class="wikitable" |+ 参数列表 |- ! 参数名 ! 说明 |- | style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | show | 当该参数内容为<code>show</code>时,将会默认展开内容 |- | style="color: #000; background-color: #f8f9fa; font-family: monospace,monospace;" | 标题 | 表格的标题部分 |- | style="color: #000; back…”
 
m Text replacement - "Category:T " to "Category:T"
 
(7 intermediate revisions 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:T{{lc:emplate documentation}}]]</noinclude>