模板:Dmbox:修订间差异
来自RIA | Wiki
更多操作
建立内容为“<templatestyles src="Dmbox/styles.css" /> <div role="note" id=" {{#switch:{{{type|}}} | setindex = setindexbox | disambig | #default = disambigbox }}"…”的新页面 |
删除魔术字 |
||
| 第29行: | 第29行: | ||
}}<!-- | }}<!-- | ||
Magic word for disambiguation pages: | Magic word for disambiguation pages: | ||
{{#if:{{{nocat|}}}||{{#ifeq:{{{type|}}}|disambig|__DISAMBIG__|}}}} | |||
Categorization: | Categorization: | ||
-->{{#switch:{{{type|}}} | -->{{#switch:{{{type|}}} | ||
2021年3月5日 (五) 22:46的版本
这是 {{Dmbox}} ([D]isambiguation footer [m]essage [box]) (消歧义页脚消息框) 元模板。
其被用于构建消歧义和同类索引条目消息框, 例如 {{Disambiguation}} 。
此模板的工作方式和 {{Ambox}} 相似且大部分使用了相同的参数。主要差异在于本消息框用于消歧义风格, 并只有2种 "type" 设定选项。
使用
简单使用例:
{{Dmbox
| text = 一些文本。
}}
{{Dmbox
| type = setindex
| text = 一些文本。
}}
稍复杂的例子:
{{Dmbox
| type = setindex
| image = [[File:Schooner.svg|30px|link=|alt=]] [[File:DAB list gray.png|30px|alt=消歧义图标]]
| textstyle = color: red; font-weight: bold; font-style: normal;
| text = 消息文本。
}}
其他一些参数组合:
参数
所有参数列表:
{{Dmbox
| type = disambig / setindex
| image = none / [[File:一些图像.svg|40px|link=|alt=]]
| imageright = [[File:一些图像.svg|40px|link=|alt=]]
| style = CSS 值
| textstyle = CSS 值
| text = 消息框文本。
| nocat = {{{nocat|}}} / true
}}
- type
- If no
|type=parameter is given the template defaults to typedisambig. - 如果未指定
|type=参数, 模板将使用默认的disambig类型。 disambig= 将页面添加至 Category:All disambiguation pages 和 Category:All article disambiguation pages 分类中。setindex= 将页面添加至 Category:All set index articles 分类中- nocat
true= 阻止模板分类。在测试和演示时很有用。Dmbox模板应始终转发此参数, 因为这样它们也可以选择隐藏类别。因此, 建议Dmbox模板始终添加与此类似的内容:nocat = {{{nocat|}}}
- image
- [No parameter] = 如果未指定
|image=参数, 模板会使用默认的的disambig或setindex图像。 - 一张图像 = 应是一张使用标准wikitext语法的图像。30px-50px的宽度通常大约正确, 具体取决于图像的高宽比。 (将宽度保持较小; 此模板中的图像不会在移动设备上自动缩小。) 例如:
image = [[File:Schooner.svg|30px|link=|alt=]]
none= 意味着不使用图像。- imageright
- 无参数 = 如果未指定 imageright 参数, 就不会在右侧显示图像。
- 一张图像 = 应是一张使用标准wikitext语法的图像。30px-50px的宽度通常大约正确, 具体取决于图像的高宽比。 (将宽度保持较小; 此模板中的图像不会在移动设备上自动缩小。) 例如:
imageright = [[File:Nuvola apps bookcase.png|40px|alt=Books icon]]
- 任何东西 = 任何你想在右侧显示的项目。
- style
- 可选的作用于整个消息框的CSS值。不带引号
" "但需要有结束分号;。例如:|style=margin-bottom: 0.2em;
- textstyle
- 作用于文本区域的CSS值。不带引号
" "但需要有结束分号;。例如:|style=text-align: center;
- text
- 消息框的主体文本, 消息框文本默认为 斜体 , 因此不需要再次设置。
技术细节
如果需要在text参数中使用特殊字符, 则需要像这样对它们进行转义:
{{Dmbox
| text = <div>
等号 (=) 和开始结束大括号 ({ }) 会正常显示。
但是需要这样表示管道符 {{!}} 和两个连续结束大括号<nowiki>}}</nowiki>.
这样表示连续管道符和结束大括号: <nowiki>|}}</nowiki>.
</div>
}}
对于更多技术细节, 可参见此模板的原讨论页。因为此模板的工作方式与 {{Ambox}}, {{Tmbox}}, {{Imbox}}, {{Cmbox}} 和 {{Ombox}} 相似, 所以这些模板的讨论页和相关页面可能也有更多细节。