Template:Mbox/doc: Difference between revisions
No edit summary |
(No difference)
|
Revision as of 02:25, 8 August 2025
<templatestyles src="Template:Nmbox/styles.css" />
{{#switch:<translate></translate> | = {{#if:{{#ifexpr: ( {{#ifeq:doc|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:mbox/doc|-1|-2}}|doc|1|0}} and {{#if:{{#translation:}}|1|0}} ) )|1|}}
|
{{#ifeq:show |show
| <templatestyles src="Module:Message box/ombox.css"></templatestyles>
| File:Codex icon book color-base.svg | <translate> This is a documentation [[<tvar name=2>Special:MyLanguage/Help:Subpages</tvar>|subpage]] for <tvar name=1>Template:Mbox</tvar>.</translate> {{#if: |<translate> It contains usage information, [[<tvar name=7>Special:MyLanguage/Help:Categories</tvar>|categories]] and other content that is not part of the original <tvar name=1>{{{text1}}}</tvar>.</translate>
|<translate> It contains usage information, [[<tvar name=7>Special:MyLanguage/Help:Categories</tvar>|categories]] and other content that is not part of the original <tvar name=1>Template</tvar> page.</translate>
}} |
}}{{#if: |
| {{#ifexist:Template:Mbox
| [[Category:{{#switch:Template
| Template | Project = Template
| Module = Module
| User = User
| #default = MediaWiki
}} documentation pages{{#translation:}}]]
| [[Category:Documentation subpages without corresponding pages{{#translation:}}]]
}}
}}
|
}}
| #default=
{{#switch:
| = {{#if:{{#ifexpr: ( {{#ifeq:doc|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:mbox/doc|-1|-2}}|doc|1|0}} and {{#if:{{#translation:}}|1|0}} ) )|1|}}
|
{{#ifeq:show |show
| <templatestyles src="Module:Message box/ombox.css"></templatestyles>
| File:Codex icon book color-base.svg | This is a documentation subpage for Template:Mbox. {{#if: |It contains usage information, categories and other content that is not part of the original {{{text1}}}. |It contains usage information, categories and other content that is not part of the original Template page.}} |
}}{{#if: |
| {{#ifexist:Template:Mbox
| [[Category:{{#switch:Template
| Template | Project = Template
| Module = Module
| User = User
| #default = MediaWiki
}} documentation pages{{#translation:}}]]
| [[Category:Documentation subpages without corresponding pages{{#translation:}}]]
}}
}}
|
}}
| #default=
Lua error: expandTemplate: template loop detected.
}} }} Lua error: Module:TNT:172: '''Missing JsonConfig extension, or not properly configured; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Lua banner.tab. See https://www.mediawiki.org/wiki/Extension:JsonConfig#Supporting_Wikimedia_templates'''. Lua error: callParserFunction: function "#translation" was not found. {{#switch:<translate></translate> | =
<templatestyles src="Module:Message box/ombox.css"></templatestyles>
| File:OOjs UI icon alert-warning.svg | {{#switch:Template
|Module={{#if:15,000
|<translate> This Lua module is used on approximately <tvar name=5>15,000</tvar> pages.</translate>
|<translate> This Lua module is used on many pages.</translate>
}}
|#default={{#if:15,000
|<translate> This template is used on approximately <tvar name=5>15,000</tvar> pages.</translate>
|<translate> This template is used on many pages.</translate>
}}
}}
{{#switch:Template |Module=<translate> To avoid large-scale disruption and unnecessary server load, any changes to this module should first be tested in its [[<tvar name=4>{{#switch:doc|doc|sandbox=Template:Mbox|#default=Template:Mbox/doc}}/sandbox</tvar>|/sandbox]] or [[<tvar name=5>{{#switch:doc|doc|sandbox=Template:Mbox|#default=Template:Mbox/doc}}/testcases</tvar>|/testcases]] subpages.</translate>
|#default=<translate> To avoid large-scale disruption and unnecessary server load, any changes to this template should first be tested in its [[<tvar name=4>{{#switch:doc|doc|sandbox=Template:Mbox|#default=Template:Mbox/doc}}/sandbox</tvar>|/sandbox]] or [[<tvar name=5>{{#switch:doc|doc|sandbox=Template:Mbox|#default=Template:Mbox/doc}}/testcases</tvar>|/testcases]] subpages or in your own [[<tvar name=9>Special:MyLanguage/Help:Subpages#Use of subpages</tvar>|user subpage]].</translate>
}} <translate> The tested changes can then be added to this page in one single edit.</translate> {{#if: |<translate> Please consider discussing any changes at <tvar name=2>[[Template:Trim]]</tvar> before implementing them.</translate> |<translate> Please consider discussing any changes on the [[<tvar name=3>{{#switch:doc|doc|sandbox=Template talk:Mbox|#default=Template talk:Mbox/doc}}</tvar>|talk page]] before implementing them.</translate>}} |
| #default=
{{#switch:
| =
<templatestyles src="Module:Message box/ombox.css"></templatestyles>
| File:OOjs UI icon alert-warning.svg | {{#switch:Template
|Module={{#if:15,000
|This Lua module is used on approximately 15,000 pages.
|This Lua module is used on many pages.
}}
|#default={{#if:15,000
|This template is used on approximately 15,000 pages.
|This template is used on many pages.
}}
}}
{{#switch:Template |Module=To avoid large-scale disruption and unnecessary server load, any changes to this module should first be tested in its [[{{#switch:doc|doc|sandbox=Template:Mbox|#default=Template:Mbox/doc}}/sandbox|/sandbox]] or [[{{#switch:doc|doc|sandbox=Template:Mbox|#default=Template:Mbox/doc}}/testcases|/testcases]] subpages.
|#default=To avoid large-scale disruption and unnecessary server load, any changes to this template should first be tested in its [[{{#switch:doc|doc|sandbox=Template:Mbox|#default=Template:Mbox/doc}}/sandbox|/sandbox]] or [[{{#switch:doc|doc|sandbox=Template:Mbox|#default=Template:Mbox/doc}}/testcases|/testcases]] subpages or in your own user subpage.
}} The tested changes can then be added to this page in one single edit. {{#if: |Please consider discussing any changes at [[Template:Trim]] before implementing them. |Please consider discussing any changes on the [[{{#switch:doc|doc|sandbox=Template talk:Mbox|#default=Template talk:Mbox/doc}}|talk page]] before implementing them.}} |
| #default=
Lua error: expandTemplate: template loop detected.
}} }}
This is the <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:mbox|mbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:mbox|mbox}}]]}} or multi namespace message box meta-template.
This meta-template is used to build message box templates that are used on several types of pages and thus need to change style depending on what page they are used on. Based on page type detected it uses one of <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}}, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}]]}}, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:imbox|imbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:imbox|imbox}}]]}}, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:cmbox|cmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:cmbox|cmbox}}]]}} and <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}]]}}.
Note that this template should only be used for message boxes that really need to adapt their style. Most message boxes do not need this and should use one of <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}}, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}]]}}, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:imbox|imbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:imbox|imbox}}]]}}, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:cmbox|cmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:cmbox|cmbox}}]]}} or <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}]]}} directly. Using those templates directly means that your template will look the same on its template page and at any other place you show it, which makes it clear on what kind of pages it is supposed to be used. It also gives you access to any extra features those templates offer, and it saves some server load.
Usage
This template takes the same parameters as <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}} and <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:imbox|imbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:imbox|imbox}}]]}} etc. See full documentation there.
Some of the boxes this template calls only handles images of max 52px width, thus that limitation also applies to this template or you will get ugly padding problems.
Demospace
This template optionally takes the "demospace" parameter to specify a namespace for testing and demonstration purposes. If you want to lock your message box to one style then instead use one of the other mboxes directly.
Namespace "Image:" was renamed to "File:" on 11 December 2008. This template was updated to understand both names well before that, thus it still works fine. For backwards compatibility it still understands "demospace = image" which means the same thing as "demospace = file". But using "demospace = image" is now deprecated.
Namespace "Book:" was added to the English Wikipedia on 28 December 2009. This template uses the <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}]]}} style on "Book:" pages or when "demospace=book". And it uses the <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}]]}} style on "Book talk:" pages or when "demospace=talk". Note that "demospace=talk" means any talk space, there is no "demospace=book talk".
Parameters
List of all parameters:
<syntaxhighlight lang=wikitext>
<templatestyles src="Module:Message box/tmbox.css"></templatestyles>
| none / File:Some image.svg | The message body text. | File:Some image.svg |
</syntaxhighlight>
Note: The small parameters only have effect when the template is on an article, talk page or an "other" page. For documentation on the small parameters see <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}}, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}]]}} and <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}]]}}. Using the small parameters when they are not valid has no effect, but also does no harm.
TemplateData
{{#switch:<translate></translate> |=
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:Mbox/doc|Template:Transclude|0|1}}|not{{#ifexpr: ( {{#ifeq:doc|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:mbox/doc|-1|-2}}|doc|1|0}} and {{#if:{{#translation:}}|1|0}} ) )|1|0}}}}|Template:Navbar}}}} {{#if:||<translate> This is the [[<tvar name=1>Special:MyLanguage/Help:TemplateData</tvar>|TemplateData]] documentation for this template used by [[<tvar name=2>Special:MyLanguage/VisualEditor</tvar>|VisualEditor]] and other tools.</translate>}}
Mbox
{{#ifeq:doc|sandbox||{{#if:{{#ifexpr: (
{{#ifeq:doc|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:mbox/doc|-1|-2}}|doc|1|0}} and {{#if:{{#translation:}}|1|0}} ) )|1|}}|[[Category:TemplateData documentation{{#translation:}}]]|[[Category:Templates using TemplateData{{#translation:}}]]}}}} | #default=
{{#switch:
|=
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:Mbox/doc|Template:Transclude|0|1}}|not{{#ifexpr: ( {{#ifeq:doc|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:mbox/doc|-1|-2}}|doc|1|0}} and {{#if:{{#translation:}}|1|0}} ) )|1|0}}}}|Template:Navbar}}}} {{#if:||This is the TemplateData documentation for this template used by VisualEditor and other tools.}}
Mbox
{{#ifeq:doc|sandbox||{{#if:{{#ifexpr: (
{{#ifeq:doc|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:mbox/doc|-1|-2}}|doc|1|0}} and {{#if:{{#translation:}}|1|0}} ) )|1|}}|[[Category:TemplateData documentation{{#translation:}}]]|[[Category:Templates using TemplateData{{#translation:}}]]}}}} | #default=
Lua error: expandTemplate: template loop detected.
}} }} <templatedata> { "description": {
"en": "This is the <templatestyles src="Module:Message box/ombox.css"></templatestyles>
| File:OOjs UI icon information-progressive.svg |
or “multi namespace message box” meta-template.", "pt-br": "Esta é a meta-predefinição <templatestyles src="Module:Message box/ombox.css"></templatestyles>
| File:OOjs UI icon information-progressive.svg |
, ou “caixa de mensagem para múltiplos espaços nominais”."
}, "format": "block", "params": { "demospace": { "label": { "en": "Demo namespace", "pt-br": "Espaço nominal de demonstração" }, "suggestedvalues": [ "main", "talk", "file", "category", "other" ], "type": "string" }, "type": { "label": { "en": "Type", "pt-br": "Tipo" }, "suggestedvalues": [ "speedy", "delete", "content", "style", "notice", "move", "protection" ], "type": "string", "default": "notice", "suggested": true }, "image": { "label": { "en": "Image (left)", "pt-br": "Imagem (esquerda)" }, "default": { "en": "Depends on the “type” parameter.", "pt-br": "Depende do parâmetro “type”." }, "suggested": true, "type": "content", "description": "Do not put in File:, can put \"none\" for no image." }, "imageright": { "label": { "en": "Image (right)", "pt-br": "Imagem (direita)" }, "type": "content", "description": "Do not put in File:" }, "style": { "label": { "en": "CSS style", "pt-br": "Estilo CSS" }, "type": "string" }, "textstyle": { "label": { "en": "Text CSS style", "pt-br": "Estilo CSS para o texto" }, "type": "string" }, "text": { "label": { "en": "Text", "pt-br": "Texto" }, "suggested": true, "type": "content" }, "small": { "label": { "en": "Small?", "pt-br": "Caixa pequena?" }, "suggestedvalues": [ "", "left", "yes", "1" ], "default": "0", "type": "boolean" }, "smallimage": { "label": { "en": "Small image (left)", "pt-br": "Imagem da caixa pequena (esquerda)" }, "suggestedvalues": [ "none" ], "default": "{{{image}}}", "type": "content" }, "smallimageright": { "label": { "en": "Small image (right)", "pt-br": "Imagem da caixa pequena (direita)" }, "suggestedvalues": [ "none" ], "default": "{{{imageright}}}", "type": "content" }, "smalltext": { "label": { "en": "Small text", "pt-br": "Texto da caixa pequena" }, "default": "{{{text}}}", "type": "content" } } } </templatedata>
Message boxes
| Template | Description |
|---|---|
| <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}} | Article message box, identifies problems or issues with the article |
| <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:cmbox|cmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:cmbox|cmbox}}]]}} | Category message box, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}} for categories |
| <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:imbox|imbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:imbox|imbox}}]]}} | Image message box, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}} for file (image) pages |
| <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ombox|ombox}}]]}} | Other pages message box, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}} for pages of the types User, Wikipedia, MediaWiki, Template, Help, Portal and any new future namespaces |
| <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:tmbox|tmbox}}]]}} | Talk page message box, <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}|{{safesubst:#if:|{{{SISTER}}}:Template:ambox|ambox}}]]}} for talk pages |
| The following templates are not called by Mbox | |
| <templatestyles src="Template:Mono/styles.css"></templatestyles>{{[[Template:{{safesubst:#if:|{{{SISTER}}}:Template:fmbox|fmbox}}|{{safesubst:#if:|{{{SISTER}}}:Template:fmbox|fmbox}}]]}} | used in system messages |
See also
- w:Wikipedia:Classes in Ambox – Describes how to use the ambox CSS classes directly in wikitables and HTML tables.
- w:Wikipedia:Manual of Style/Article message boxes – The style guideline for creating article message boxes.
- w:Wikipedia talk:Manual of Style/Article message boxes – For discussion about these matters.