更改

来自中文乐谱库

模板:Cmbox/doc

添加7,188字节2013年3月10日 (日) 10:47
移除跨語言連結,現在由維基數據d:Q6042279提供
{{Documentation subpage}}
<includeonly>{{intricate template}}</includeonly>
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{mbox templates}}

本模板是{{tl|cmbox}}或 '''分类信息框'''(category message box)元模板。

它用于建立分类页面的消息框模板,如{{tl|CatDiffuse}}等。它提供若干種不同的顏色,当无图像参数给出时使用预设图像,它还有其他特點。

该模板的工作与{{tl|ambox}}几乎相同,并使用同样的参数。


=== 用法 ===

简单应用的例子:

<pre>
{{cmbox | text = Some text.}}
</pre>

{{cmbox | text = Some text.}}


复杂应用的例子:

<pre>
{{cmbox
| type = style
| image = [[File:Emblem-question-yellow.svg|40px]]
| style = width: 400px;
| textstyle = color: red; font-weight: bold; font-style: italic;
| text = 消息框的主体文字。
}}
</pre>

{{cmbox
| type = style
| image = [[File:Emblem-question-yellow.svg|40px]]
| style = width: 400px;
| textstyle = color: red; font-weight: bold; font-style: italic;
| text = 消息框的主体文字。
}}

=== 分类信息框类别 ===

以下范例使用了不同的type参数,但没有使用image参数,因而使用了各type(类型)所对应的预设圖像。

{{cmbox
| type = speedy
| text = type=<u>speedy</u> – 快速删除模板,如{{tl|db-catempty}}.
}}
{{cmbox
| type = delete
| text = type=<u>delete</u> – 删除模板,如{{tl|cfd}}.
}}
{{cmbox
| type = content
| text = type=<u>content</u> – 大警告与问题,如{{tl|CategorisationDisputedPeople}}.
}}
{{cmbox
| type = style
| text = type=<u>style</u> – 小警告与问题,如{{tl|popcat}}.
}}
{{cmbox
| type = notice
| text = type=<u>notice</u> – 各种提示与信息,永久性的与暂时性的。
}}
{{cmbox
| type = move
| text = type=<u>move</u> – 移动,合并与分割信息和提议,如{{tl|categoryredirect}}.
}}
{{cmbox
| type = protection
| text = type=<u>protection</u> – 保护模板,如{{tl|pp-semi-protected}},当显示于分类页面上时。
}}

=== 其他图片 ===

上方显示的预设图像是十分方便的,但在很多情况下需要使用特别指定的图像。以下是一些使用'''image'''参数来指定其他图像的案例:

{{cmbox
| type = style
| image = [[File:Sub-arrows.svg|40px]]
| text = type = style <br> image = <nowiki>[[File:Sub-arrows.svg|40px]]</nowiki> <br> 这张图像通常用于{{tl|verylarge}}和 {{tl|CatDiffuse}}.
}}
{{cmbox
| type = move
| image = [[File:Redirect arrow.svg|52px]]
| text = type = move <br> image = <nowiki>[[File:Redirect arrow.svg|52px]]</nowiki> <br> 这张图像通常用于 {{tl|categoryredirect}}.
}}

=== 特殊设定 ===

此外,还有一些其他的参数。

{{cmbox
| text = 未给出type和image参数 ('''default''')
}}
{{cmbox
| image = none
| text = 未给出type且 '''image=none''' – 不使用图片,而'''text'''将占用消息框的整个区域。
}}

{{cmbox
| image = [[File:Gnome globe current event.svg|42px]]
| imageright = [[File:Nuvola apps bookcase.svg|40px]]
| text = image = <nowiki>[[File:Gnome globe current event.svg|42px]]</nowiki> <br> imageright = <nowiki>[[File:Nuvola apps bookcase.svg|40px]]</nowiki>
}}

{{cmbox
| image = [[File:Gnome globe current event.svg|42px]]
| imageright = [[File:Shuttle.svg|20px]]
| text = '''此分类下的条目当前正在进行[[宇航|空间任务]]。'''
<br>由{{tl|current spaceflight}}模板集中。
}}

=== 参数 ===

所有参数的列表:

<pre>
{{cmbox
| type = speedy / delete / content / style / notice / move / protection
| image = none / [[File:Some image.svg|40px]]
| imageright = [[File:Some image.svg|40px]]
| style = CSS values
| textstyle = CSS values
| text = The message body text.
}}
</pre>

'''type'''
:如果不指定'''type'''参数的话,会返回用于“条目注意”的预设类型'''notice'''的模板。这意味着会像上文中的简单应用那样产生一个蓝色的边框。

'''image'''
:'''No parameter''' = 如果不指定'''image'''参数的话,会返回使用预设图像的模板。至于是哪张预设图像则取决于'''type'''参数。
:'''An image''' = 应该是一幅带有常见维基符号的图像。通常为40px-50px的宽度,这取决于图像的长宽比。(但消息框可应付各种尺寸的图像。)例如:
::<code><nowiki>image = [[File:Sub-arrows.svg|40px]]</nowiki></code>
:'''none''' = 不使用图像。

'''imageright'''
:'''No parameter''' = 如果不指定'''imageright'''参数的话,会返回右侧不带图像的模板。
:'''An image''' = 应该是一幅带有常见维基符号的图像。通常为40px-50px的宽度,这取决于图像的长宽比。(但消息框可应付各种尺寸的图像。)例如:
::<code><nowiki>imageright = [[File:Nuvola apps bookcase.png|40px]]</nowiki></code>
:'''Anything''' = 任何你想在模板右侧显示的其他内容。

'''style'''
:An optional [[Cascading Style Sheets|CSS]] value used by the entire message box table. Without quotation marks <code>" "</code>. For example:
::<code>style = margin-bottom: 0.5em;</code>

'''textstyle'''
:An optional [[Cascading Style Sheets|CSS]] value used by the text cell. For example:
::<code>textstyle = text-align: center;</code>

'''text'''
:消息框的主体文字。

=== 技术细节 ===

如果你需要在text参数中使用一些特殊字符的话,那么就需要像这样将它们换码:

<pre>
{{cmbox
| text = <div>
等号 = 与前后大括号{ }可以正常地使用。
但是管道符{{!}}与两个连着的后大括号<nowiki>}}</nowiki>则不能直接使用。
一起用同样要带nowiki标记<nowiki>|}}</nowiki>。
</div>
}}
</pre>

{{cmbox
| text = <div>
等号 = 与前后大括号{ }可以正常地使用。
但是管道符{{!}}与两个连着的后大括号<nowiki>}}</nowiki>则不能直接使用。
一起用同样要带nowiki标记<nowiki>|}}</nowiki>。
</div>
}}

此模板使用CSS类来确定显示风格,因此可被更换到其他风格。

在此元模板内使用了HTML的表格标示法,而没有使用维基式的表格标示法。在制作元模板时这是一个常见的方法,因为维基式标示法存在一些缺陷。譬如,维基式标示法会加大[[Help:模板扩展语法|模板扩展语法]]及参数中特殊字符使用的难度。

此元模板所用的缺省图片用的是png格式的,而不是svg格式。其主要原因是在处理MediaWiki为svg图片所渲染的透明背景时,一些老版本的网络浏览器会遇到一些麻烦。这里的png格式图片有手工优化过的透明背景颜色,因而在所有的浏览器中它们看上去都是好的。请注意,svg图标只会在一些老版本的浏览器中看上去有点不对头,因此只有那些非常广泛使用的图标才值得费些功夫去做那种手工优化。

更多的技术细节参见[[{{TALKPAGENAME}}|讨论页]]以及下方的[[#參見]]一节。

=== 参见 ===

{{Mbox templates see also}}

<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:维基百科元模板|{{PAGENAME}}]]
[[Category:分类页模板| ]]
</includeonly>
匿名用户