跳转到内容

Template:Mbox/doc:修订间差异

勤求古训,博采众方
删除的内容 添加的内容
创建 Mbox 文档
 
从求闻适配 Mbox 文档(移除求闻特有 delcat/NoteTA 等,样例改 nocat=true,分类对齐中医百科)
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
{{uses Lua|Module:Message box}}
{{Documentation subpage}}
{{uses TemplateStyles|MediaWiki:Gadget-SiteCommon.css}}
{{Mbox templates}}
{{Mbox templates}}
{{Uses Lua|Module:Message box}}


'''{{tl|Mbox}}''' 是一個元模板(在其他模板中引用的模板)。使用本模板將產生一個橫幅訊息框,並可在各種不同類型的頁面使用,無需手動變更橫幅訊息框的樣式,模板能偵測其所在的名字空間,並自動選擇適合的模板样式使用。
'''{{tlx|Mbox}}'''(multi namespace message box,多命名空间消息框)是一个元模板,用于根据页面所在命名空间自动选择对应的消息框样式。它内部调用 {{tlx|Ambox}}(条目)、{{tlx|Tmbox}}(讨论)、{{tlx|Imbox}}(文件)、{{tlx|Cmbox}}(分类)和 {{tlx|Ombox}}(其他页面)。


== 參數 ==
本模板仅用于需要在多个命名空间中显示且需要自动适配样式的消息框。一般情况下,建议直接使用 {{tlx|Ambox}}、{{tlx|Tmbox}} 等具体模板——这样模板在其自身页面和任何使用位置外观一致,编辑者能清楚其用途,同时也减轻服务器负担。
以下列出本模板的所有參數:

<pre>-{}-
== 参数 ==
{{Mbox
<syntaxhighlight lang="wikitext">
{{mbox
| demospace = {{{demospace|}}} / main / talk / file / category / other
| demospace = {{{demospace|}}} / main / talk / file / category / other
| type = speedy / delete / content / style / notice / move / protection
| type = speedy / delete / content / style / notice / move / protection
| image = none / [[File:Some image.svg|40px]]
| image = 可留空 / [[File:圖片檔案名稱.svg|40px]]
| imageright = [[File:Some image.svg|40px]]
| imageright = 可留空 / [[File:圖片檔案名稱.svg|40px]]
| style = CSS 代码
| style = 可留空 / CSS 代碼
| textstyle = CSS 代码
| textstyle = 可留空 / CSS 代碼
| text = 消息正文
| text = 橫幅訊息框內的文字
| small = {{{small|}}} / left / yes
| small = {{{small|}}} / left / yes
| smallimage = none / [[File:Some image.svg|30px]]
| smallimage = 可留空 / [[File:Some image.svg|30px]]
| smallimageright = none / [[File:Some image.svg|30px]]
| smallimageright = 可留空 / [[File:Some image.svg|30px]]
| smalltext = 小尺寸消息文本
| smalltext = 一段以較小字體顯示的文字
}}
}}
</pre>
</syntaxhighlight>


請注意:「small」參數僅在條目、討論頁(Talk)和其他(Other)命名空间中有效。
== Demospace ==
<code>demospace</code> 参数用于测试和演示,可强制指定命名空间。例如 <code>demospace=main</code> 强制显示条目样式。如需固定消息框样式,应直接使用对应的专用模板。


在条目空间中,mbox模板的特殊用法,参见[[Template:Ambox/doc]]。
== 参见 ==

* [[Wikipedia:条目消息框样式指南]]
在非条目、非讨论页空间中,Ombox模板右侧“快捷方式”的特殊用法,参见[[Template:Mbox/shortcut|Template:Ombox/shortcut]]。

== 样例 ==
{{Mbox
| type = speedy
| nocat = true
| text = type=<u>speedy</u>-请求快速刪除,如 {{tl|delete}}。
}}
{{Mbox
| type = delete
| nocat = true
| text = type=<u>delete</u>-请求删除,如 {{tl|afd}} 与 {{tl|vfd}} 。
}}
{{Mbox
| type = content
| nocat = true
| text = type=<u>content</u>-内容问题,如 {{tl|POV}} 与 {{tl|globalize}} 。
}}
{{Mbox
| type = style
| nocat = true
| text = type=<u>style</u>-格式问题,如 {{tl|cleanup}} 与 {{tl|wikify}}。
}}
{{Mbox
| type = move
| nocat = true
| text = type=<u>move</u>-合并、拆分及跨维基提议,如 {{tl|split}} 与 {{tl|splitsection}}。
}}
{{Mbox
| type = protection
| nocat = true
| text = type=<u>protection</u>-页面保护,如 {{tl|Protected}}。
}}
{{Mbox
| type = notice
| nocat = true
| text = type=<u>notice</u>-条目注意,如 {{tl|current}} 与 {{tl|inuse}}。
}}

=== 特定领域 ===
==== 方针 ====
{{Mbox
| type = policy
| nocat = true
| text = type=<u>policy</u>-通用方针。
}}
{{Mbox
| type = guideline
| nocat = true
| text = type=<u>guideline</u>-专用方针。
}}
{{Mbox
| type = rule
| nocat = true
| text = type=<u>rule</u>-一般方针。
}}
{{Mbox
| type = draft
| nocat = true
| text = type=<u>draft</u>-草稿。
}}

==== 文件 ====
{{Mbox
| type = license
| nocat = true
| text = type=<u>license</u>-文件许可证,需要搭配相应的<u>class=</u>使用;参见{{tl|Style formatting license template}}。
}}
{{Mbox
| type = license
| class = license-pd
| nocat = true
| text = type=<u>license</u>、<u>class=license-pd</u>-公有领域许可证。
}}
{{Mbox
| type = license
| class = license-cc
| nocat = true
| text = type=<u>license</u>、<u>class=license-cc</u>-知识共享许可证。
}}
{{Mbox
| type = license
| class = license-free
| nocat = true
| text = type=<u>license</u>、<u>class=license-free</u>-自由许可证。
}}
{{Mbox
| type = license
| class = license-nonfree
| nocat = true
| text = type=<u>license</u>、<u>class=license-nonfree</u>-非自由文件版权理据。
}}
{{Mbox
| type = license
| class = license-other
| nocat = true
| text = type=<u>license</u>、<u>class=license-other</u>-其他版权理据。
}}

=== 其他 ===
{{Mbox
| type = featured
| nocat = true
| text = type=<u>featured</u>-优秀内容(用于优秀文件页面、优秀条目讨论页)。
}}
{{Mbox
| class = mbox-setindex
| image = [[File:DAB_list_gray.svg|80px]]
| nocat = true
| text = type=<u>setindex</u>、type=<u>disambig</u>-目录内容、消歧义内容。
}}


== 參見 ==
<includeonly>
{{Mbox templates see also}}<includeonly>{{sandbox other||
[[Category:消息框模板]]
[[Category:消息框模板]]
</includeonly>
}}</includeonly>

2026年8月7日 (五) 09:50的最新版本

消息框模板

{{Mbox}} 是一个元模板(在其他模板中引用的模板)。使用本模板将产生一个横幅讯息框,并可在各种不同类型的页面使用,无需手动变更横幅讯息框的样式,模板能侦测其所在的名字空间,并自动选择适合的模板样式使用。

参数

以下列出本模板的所有参数:

 
{{Mbox
| demospace = {{{demospace|}}} / main / talk / file / category / other
| type  = speedy / delete / content / style / notice / move / protection
| image = 可留空 / [[File:图片档案名称.svg|40px]]
| imageright = 可留空 / [[File:图片档案名称.svg|40px]]
| style = 可留空 / CSS 代码
| textstyle  = 可留空 / CSS 代码
| text  = 横幅讯息框内的文字
| small = {{{small|}}} / left / yes
| smallimage = 可留空 / [[File:Some image.svg|30px]]
| smallimageright = 可留空 / [[File:Some image.svg|30px]]
| smalltext  = 一段以较小字体显示的文字
}}

请注意:“small”参数仅在条目、讨论页(Talk)和其他(Other)命名空间中有效。

在条目空间中,mbox模板的特殊用法,参见Template:Ambox/doc。

在非条目、非讨论页空间中,Ombox模板右侧“快捷方式”的特殊用法,参见Template:Ombox/shortcut。

样例

特定领域

方针

文件

其他

参见

  • {{mbox}} – 多命名空间消息框(自动检测命名空间)
  • {{ambox}} – 条目消息框
  • {{tmbox}} – 讨论页消息框
  • {{ombox}} – 其他页面消息框
  • {{fmbox}} – 页眉和页脚消息框
  • {{dmbox}} – 消歧义消息框