跳转到内容

模板:Collapsible test case

维基文库,自由的图书馆
文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

This template creates a test case of two or more templates contained in a collapsible box. If the outputs of all the templates is the same, the box is collapsed, but if any of them differ from each other the box is left uncollapsed. There are a variety of different formats and options that can be used.

Each template is called with the same parameters. All parameters passed to this template are passed through to the test-case templates, with the exception of parameters starting with an underscore character ("_"), which are reserved for internal use.

If no templates are specified explicitly, the module uses the base page of the current page as the first template, and its /sandbox subpage as the second template. If only one template is specified explicitly, its /sandbox subpage is used as the second template.

Usage

[编辑]

Basic syntax

{{collapsible test case
| [param1] = [value1]
| [param2] = [value2]
| [param3] = [value3]
...
}}

Full syntax

For the full syntax, see Template:Test case. This template is equivalent to that one with the |_collapsible= parameter set to "yes" by default.

Examples

[编辑]

Compare template and sandbox (default format)

[编辑]
Usage
{{collapsible test case
| _template1 = ombox
| text = Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tristique sagittis cursus.
}}
Output
{{ombox}}

{{ombox}}

{{ombox/sandbox}}

Compare two different templates (default format)

[编辑]
Usage
{{collapsible test case
| _template1 = ombox
| _template2 = tmbox
| text = Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tristique sagittis cursus.
}}
Output
{{ombox}}

{{ombox}}

{{tmbox}}

Compare template and sandbox (rows format)

[编辑]
Usage
{{collapsible test case
| _format = rows
| _template1 = ombox
| text = Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tristique sagittis cursus.
}}
Output
{{ombox}}
{{ombox}}
{{ombox/sandbox}}

Compare template and sandbox (columns format)

[编辑]
Usage
{{collapsible test case
| _format = columns
| _template1 = ombox
| text = Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tristique sagittis cursus.
}}
Output
{{ombox}}
左右对比
{{ombox}}{{ombox/sandbox}}

Compare template and sandbox (inline format, show code)

[编辑]
Usage
{{collapsible test case
| _format = inline
| _showcode = yes
| _template1 = ombox
| text = Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tristique sagittis cursus.
}}
Output
{{ombox}}
  • {{ombox|text=Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tristique sagittis cursus.}}
  • {{ombox/sandbox|text=Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tristique sagittis cursus.}}

See also

[编辑]

Templates invoking Module:Template test case: