模板:Tmbox/doc
本文件是Template:Tmbox的文件子頁面(見模板頁自身)。 本頁包含用法資訊、分類和其他非原模板頁面的內容。 |
此模板目前缺乏相關中文使用說明。請知曉此模板目的及使用方法的編輯者協助編寫說明文件或者翻譯其他語言版本。 本模板可能使用了參數,若無完整的使用說明將不便於他人了解、引用、維護與修改。 |
Template:Mbox templates 這個模板為討論頁消息提示元模板。
這個模板被用來構建討論頁消息提示框,如{{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.
參見
編輯Template:Mbox templates see also
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.