模板:Tmbox/doc
此页面是Template:Tmbox的模板文档。 此页面可能包含了模板的使用说明、分类和其他内容。 |
此模板文档被引用于约303,000个页面,占全部页面的4%。 为了避免造成大规模的影响,所有对此模板文档的编辑应先于沙盒、测试样例或您的沙盒上测试。 测试后无误的版本可以一次性地加入此模板文档中,但是修改前请务必于讨论页发起讨论。 模板引用数量会自动更新。 |
此模板使用Lua语言: |
本模板使用以下模板样式: |
信息框元模板 | |
---|---|
模板 | 背景 |
{{Ambox}} | 条目 |
{{Cmbox}} | 分类 |
{{Imbox}} | 图片 |
{{Tmbox}} | 讨论 |
{{Fmbox}} | 页脚/标题 |
{{Ombox}} | 其他页面 |
{{Mbox}} | 自动侦测 |
{{Asbox}} | 小作品 |
{{Dmbox}} | 消歧义 |
此模板的文档不存在、不全面或不能详细描述其功能及/或其代码中的参数。请帮助扩充并改进其文档。 |
这个模板为讨论页消息提示元模板。
这个模板被用来构建讨论页消息提示框,如{{central}}。 它提供了几种不同的颜色。如果没有给出图像参数,则使用默认的图像,而且它还有其他一些功能。
这个模板通常不应该被用于WikiProject横幅。他们有特殊的需求,因此有自己的元模板。参见下面的 "另见 "部分的链接。
该模板与{{ambox}}模板工作原理相类似,并使用相同的参数。
我们正在部署!
在讨论页面上讨论和公示后,我们现在部署这个模板。欢迎将任何在用户讨论页面上使用的消息框转换为使用这个元模板。如果你发现有什么棘手的情况,那么就在本模板的讨论页上列出,你会得到帮助。
当使用这个模板来构建讨论页消息提示框时,这些框应该像以前一样包含说明性文字。(和以前一样的文本或新的改进文本)。如果框中有更具体的图片,或者你知道的更好的图片,那么就用它们来代替这里显示的默认图片。
建议的样式标准
讨论页信息框的类型与所有其他命名空间的信息框遵循相同的命名惯例,但任何特定讨论页信息框的类型可能不像其他命名空间那样明显。 在决定通话页消息框的类型时,请考虑以下准则:
- speedy只应该被用于快速删除模板。
- delete 只应该被用于与正在进行的删除讨论相关的模板。不要为了给自己消息框加个好看的红边框使用这个参数。
- content和style只应该被用于警告和提醒。content有橙色边框,用于更加重要、紧急的警告。style有黄色边框,用于较低重要度警告。这两种类型的信息框只应用于临时用途,不宜在讨论页上长期留存。
- move和protection只应该被用于与移动、合并、页面保护相关的消息框。
- notice参数应该被用于大部分讨论页信息框,以提醒,告知相关信息。这个参数几乎可以通用。
用法
一些用法:
{{tmbox | text = 示例文本}}
示例文本 |
复杂用法:
{{tmbox
| type = style
| image = [[File:Emblem-question-yellow.svg|40px]]
| style = width: 400px;
| textstyle = color: red; font-weight: bold; font-style: italic;
| text = The message body text.
}}
讨论页消息框样式
以下示例为指定不同type参数但不指定图片参数输出的默认图像
type=speedy——快删模板 |
type=delete——删除模板 |
type=content——大部分警告和提醒 |
type=style——较小警告和问题 |
type=notice – Notices and messages of any kind, both permanent and temporary. |
type=move – Merge, split, rename and transwiki messages and proposals. |
type=protection – Protection templates. |
更高级的操作
各种参数的混合实例:
- type、image参数留空:默认样式
No type and no image given (default) |
- image参数指定为none(image=none):纯信息
No type and image=none – No image is used and the text uses the whole message box area. |
- 实现左右两张图片(image = [[File:Gnome globe current event.svg|42px]] | imageright = [[File:Nuvola apps bookcase.svg|40px]]):指定imageright参数
image = [[File:Gnome globe current event.svg|42px]] imageright = [[File:Nuvola apps bookcase.svg|40px]] |
参数
各参数使用列表:
{{tmbox
| 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.
| small = {{{small|}}} / yes
| smallimage = none / [[File:Some image.svg|30px]]
| smallimageright = none / [[File:Some image.svg|30px]]
| smalltext = A shorter message body text.
}}
type
- If no type parameter is given the template defaults to type notice. That means it gets a gray border.
image
- No parameter = If no image parameter is given the template uses a default image. Which default image it uses depends on the type parameter.
- An image = Should be an image with usual wiki notation. 40px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
image = [[File:Crystal package settings.png|40px]]
- none = Means that no image is used.
imageright
- No parameter = If no imageright parameter is given then no image is shown on the right side.
- An image = Should be an image with usual wiki notation. 40px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
imageright = [[File:Nuvola apps bookcase.svg|40px]]
- Anything = Any other object that you want to show on the right side.
style
- Optional CSS values used by the entire message box table. Without quotation marks
" "
but with the ending semicolons;
. For example:style = margin-bottom: 0.5em;
textstyle
- Optional CSS values used by the text cell. For example:
textstyle = text-align: center;
text
- The message body text.
The small parameters
small = yes |
type = style small = yes |
small
- yes = Makes it a smaller right floating message box. This also makes the default images smaller. Note that any data fed to the smallimage, smallimageright and smalltext parameters is only used if "small=yes". To make it so your template also understands the small parameter you can use this code:
small = {{{small|}}}
small = yes image = [[File:Nuvola apps bookcase.svg|40px]] smallimage = [[File:Nuvola apps bookcase.svg|30px]] |
smallimage
- No parameter = If no smallimage parameter is given then this template falls back to use the image parameter. If the image parameter also is empty then a small default image is used.
- An image = Should be an image with usual wiki notation. 30px width is usually about right. For example:
smallimage = [[File:Crystal package settings.png|30px]]
- none = Means that no image is used. This overrides any image fed to image, when "small=yes".
small = yes imageright = [[File:Nuvola apps bookcase.svg|40px]] |
small = yes imageright = [[File:Nuvola apps bookcase.svg|40px]] smallimageright = none |
smallimageright
- No parameter = If no smallimageright parameter is given then this template falls back to use the imageright parameter. If the imageright parameter also is empty then no image is shown on the right side.
- An image = Should be an image with usual wiki notation. 30px width is usually about right. For example:
smallimageright = [[File:Nuvola apps bookcase.svg|30px]]
- Anything = Any other object that you want to show on the right side.
- none = Means that no right side image is used. This overrides any image fed to imageright, when "small=yes".
smalltext
- A shorter version of the message body text. If no smalltext parameter is given then this template falls back to use the text parameter.
Technical details
If you need to use special characters in the text parameter then you need to escape them like this:
{{tmbox
| text = <div>
Equal sign = and a start and end brace { } work fine as they are.
But here is a pipe {{!}} and two end braces <nowiki>}}</nowiki>.
And now a pipe and end braces <nowiki>|}}</nowiki>.
</div>
}}
Equal sign = and a start and end brace { } work fine as they are. But here is a pipe | and two end braces }}. And now a pipe and end braces |}}. |
This template uses the tmbox CSS classes in MediaWiki:Common.css for most of its looks, thus it is fully skinnable.
This template calls {{tmbox/core}} which holds most of the code for {{tmbox}}, while {{tmbox}} itself does parameter preprocessing.
Internally this meta-template uses HTML markup instead of wiki markup for the table code. That is the usual way we make meta-templates since wiki markup has several drawbacks. For instance it makes it harder to use parser functions and special characters in parameters.
For more technical details see the talk page. Since this template works almost exactly like {{ambox}}, {{imbox}}, {{cmbox}} and {{ombox}} their talk pages and related pages might also contain more details.
参见
在讯息框(mbox)家族中的元模板:
{{ambox}}
:用于条目讯息框{{tmbox}}
:用于讨论页讯息框{{imbox}}
:用于图像页讯息框{{cmbox}}
:用于分类讯息框{{ombox}}
:用于其他页面讯息框{{mbox}}
:有名字空间探测功能。某些消息框会用在几类页面并因此需要依据所用在的页面来改变风格,这种情况下的消息框可以用此元模板。
有相近关系的元模板:
Other pages:
- Wikipedia:Talk page templates – The guideline specifying the styles for talk page message boxes.
WikiProject banners:
- {{WikiProjectBannerShell}} and {{WPBannerMeta}} – A system for collapsing, wrapping and creating WikiProject banners.
- {{WikiProjectBanners}} – Another system for collapsing WikiProject banners.