Template:Collapse list:修订间差异

(建立内容为“<includeonly><div class="mw-collapsible mw-collapsed">{{{type}}} <div class="mw-collapsible-content"> {{{body}}} </div> </div></includeonly><noinclude> == Paramet…”的新页面)
 
无编辑摘要
 
第1行: 第1行:
<includeonly><div class="mw-collapsible mw-collapsed">{{{type}}}
<includeonly><div class="mw-collapsible mw-collapsed" style="<!---->{{#ifeq:{{{style|{{{1|}}} }}}|inline|display: inline-block;|{{{style|{{{1}}} }}} }}">{{#if:{{{type|}}}|{{{type}}}|{{{1}}}}}{{0|&nbsp;}}
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
{{{body}}}
{{{2|{{{body}}}}}}
</div>
</div>
</div></includeonly><noinclude>
</div></includeonly><noinclude>
== Parameters ==
== Parameters ==
This template builds collapsible lists with titles.
This template builds collapsible lists with titles.
{| class="wikitable"
|-
! Parameter
! Description
! Default
! Status
|-
| 1
| list name
| empty
| '''required'''
|-
| 2
| list content
| empty
| '''required'''
|-
| style
|
* If set to 'inline', the [Expand] tag is left-aligned instead of right-aligned.
* If set to anything else, inserts it into the style tag for the list's <nowiki><div></nowiki>.
| empty
| '''optional'''
|}


=== Old style ===
For backwards compatibility, these parameters remain valid. If parameter 1 is set to "inline", the parameter type must be used for the list name.
{| class="wikitable"
{| class="wikitable"
|-
|-
第23行: 第49行:
| empty
| empty
| '''required'''
| '''required'''
|-
| 1
|
* If set to 'inline', the [Expand] tag is left-aligned instead of right-aligned.
* If set to anything else, inserts it into the style tag for the list's <nowiki><div></nowiki>.
| empty
| '''optional'''
|}
|}


== Examples ==
<code><nowiki>{{collapse list|type=List|body= * Item}}</nowiki></code>
{{collapse list|type=List|body= * Item}}
----
<code><nowiki>{{collapse list|inline|type={{icon|unknown}} Inline list|body= * Item}}</nowiki></code>
{{collapse list|inline|type={{icon|unknown}} Inline list|body= * Item}}
----
<code><nowiki>{{collapse list|background-color:lightgreen; border:solid;|type=Green, bordered list|body= * Item}}</nowiki></code>
{{collapse list|background-color:lightgreen; border:solid;|type=Green, bordered list|body= * Item}}
== Limitations ==
This template cannot be used as part of lists as it breaks the collapsing effect.
*{{collapse list|inline|type=List|* Item
* Item 2
** Item 3}}
It can also not be used inline with a paragraph unless the whole paragraph is wrapped with <code><nowiki><span></nowiki></code> and the inline effect is applied, but even then the expand effect will break the flow of the paragraph.
Example text including {{collapse list|inline|type=List|* Item
* Item 2
** Item 3}} text continues after
<span>Example text including {{collapse list|style=inline|list|* Item
* Item 2
** Item 3}} text continues after</span>
[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>

2025年8月16日 (六) 22:17的最新版本

Parameters

This template builds collapsible lists with titles.

Parameter Description Default Status
1 list name empty required
2 list content empty required
style
  • If set to 'inline', the [Expand] tag is left-aligned instead of right-aligned.
  • If set to anything else, inserts it into the style tag for the list's <div>.
empty optional

Old style

For backwards compatibility, these parameters remain valid. If parameter 1 is set to "inline", the parameter type must be used for the list name.

Parameter Description Default Status
type list name empty required
body list content empty required
1
  • If set to 'inline', the [Expand] tag is left-aligned instead of right-aligned.
  • If set to anything else, inserts it into the style tag for the list's <div>.
empty optional

Examples

{{collapse list|type=List|body= * Item}}

List 
  • Item

{{collapse list|inline|type={{icon|unknown}} Inline list|body= * Item}}

Unknown Inline list 
  • Item

{{collapse list|background-color:lightgreen; border:solid;|type=Green, bordered list|body= * Item}}

Green, bordered list 
  • Item

Limitations

This template cannot be used as part of lists as it breaks the collapsing effect.

  • List 
  • Item
  • Item 2
    • Item 3

It can also not be used inline with a paragraph unless the whole paragraph is wrapped with <span> and the inline effect is applied, but even then the expand effect will break the flow of the paragraph.

Example text including

List 
  • Item
  • Item 2
    • Item 3

text continues after

Example text including
list 
  • Item
  • Item 2
    • Item 3
text continues after