Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
(创建页面,内容为“<includeonly>{{ #vardefine: delimiter | {{ #switch: {{{delimiter|}}}{{{d|}}} | , = ,  | and = 和  | & =  &  | or = …”)
 
(以“<includeonly><span style="word-break: break-word;">{{#invoke: Array | main | wrap=samp }}</span></includeonly><noinclude> {{documentation}} </noinclude>”替换内容)
标签替换
 
第1行: 第1行:
  +
<includeonly><span style="word-break: break-word;">{{#invoke: Array | main | wrap=samp }}</span></includeonly><noinclude>
<includeonly>{{ #vardefine: delimiter | {{
 
#switch: {{{delimiter|}}}{{{d|}}}
 
| , = ,&nbsp;
 
| and = &#32;和&nbsp;
 
| &amp; = &nbsp;&amp;&nbsp;
 
| or = &#32;或&nbsp;
 
| to = &#32;到&nbsp;
 
| newline | br = <br/>
 
| list | list-newline | bullet | * = <br/>
 
{{{list-level|**}}}
 
| and-list = &#32;和<br/>
 
{{{list-level|**}}}
 
| comma-list = ,<br/>
 
{{{list-level|**}}}
 
| none = <nowiki/>
 
| #default = {{{delimiter|&nbsp;}}}
 
}}
 
}}{{
 
#vardefine: mid-delimiter | {{
 
#switch: {{{delimiter|}}}{{{d|}}}
 
| and | &amp; | or = ,&#32;
 
| and-list = ,<br>
 
{{{list-level|**}}}
 
| #default = {{#var: delimiter}}
 
}}
 
}}{{
 
#vardefine: serial | {{
 
#switch: {{{delimiter|}}}{{{d|}}}
 
| and | or | and-list = ,
 
}}
 
}}<span style="word-break: break-word;"><samp>{{{1}}}</samp>{{
 
#if: {{{2|}}} | {{ #if: {{{3|}}} |{{#var: mid-delimiter}} | {{#var: delimiter}} }}<samp>{{{2}}}</samp>
 
}}{{ #if: {{{3|}}} | {{ #if: {{{4|}}} |{{#var: mid-delimiter}} | {{#var:serial}}{{#var: delimiter}} }}<samp>{{{3}}}</samp>
 
}}{{ #if: {{{4|}}} | {{ #if: {{{5|}}} |{{#var: mid-delimiter}} | {{#var:serial}}{{#var: delimiter}} }}<samp>{{{4}}}</samp>
 
}}{{ #if: {{{5|}}} | {{ #if: {{{6|}}} |{{#var: mid-delimiter}} | {{#var:serial}}{{#var: delimiter}} }}<samp>{{{5}}}</samp>
 
}}{{ #if: {{{6|}}} | {{ #if: {{{7|}}} |{{#var: mid-delimiter}} | {{#var:serial}}{{#var: delimiter}} }}<samp>{{{6}}}</samp>
 
}}{{ #if: {{{7|}}} | {{ #if: {{{8|}}} |{{#var: mid-delimiter}} | {{#var:serial}}{{#var: delimiter}} }}<samp>{{{7}}}</samp>
 
}}{{ #if: {{{8|}}} | {{ #if: {{{9|}}} |{{#var: mid-delimiter}} | {{#var:serial}}{{#var: delimiter}} }}<samp>{{{8}}}</samp>
 
}}{{ #if: {{{9|}}} | {{ #if: {{{10|}}}|{{#var: mid-delimiter}} | {{#var:serial}}{{#var: delimiter}} }}<samp>{{{9}}}</samp>
 
}}{{ #if: {{{10|}}}| {{#var:serial}}{{ #var: delimiter }}<samp>{{{10}}}</samp>
 
}}{{ #if: {{{11|}}}|<span style="color:red">'''错误:'''参数太多,最多10个</span>[[Category:Samp模板错误]]
 
}}</span></includeonly><noinclude>
 
 
{{documentation}}
 
{{documentation}}
 
</noinclude>
 
</noinclude>

2021年10月5日 (二) 05:15的最新版本

[查看 | 编辑 | 历史 | 清除缓存]文档页面
参见:Template:Code
Lua logo.svg

此模板使用了模块:Array,此脚本使用Lua编写。
更多详情,请参阅维基百科:LuaMediaWiki:扩展:Scribunto

此模板是<samp>...</samp>的简化用法。它支持任意多个参数;所有内容都将由<samp>元素包装。

可设置一个可选的{{{delimiter}}}参数,以指定每个元素之间的默认空间。

注意,如果参数包含管道符号(|)或等号(=),则需要在参数值周围加上<nowiki>...</nowiki>,否则它们将分别被视为参数分隔符或参数标识符。另外,你也可以改用{{!}}&#124;{{=}}&#61;代替。

示例

  1. {{samp|text}}text
  2. {{samp|1|2|3|4|5}}12345
  3. {{samp|1|2|3|4|5|delimiter=、}}12345
  4. {{samp|1|2|3|4|5|d=pretty}}12345
  5. {{samp|<nowiki>something=one|two|three<nowiki>}}something=one|two|three
  6. {{samp|something{{=}}one{{!}}two&#124;three}}something=one|two|three