Template:Ambox/doc: Difference between revisions

m
1 revision imported
m (1 revision imported)
 
m (1 revision imported)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- Categories go where indicated at the bottom of this page, please; interwikis go to Wikidata (see also: [[Wikipedia:Wikidata]]) -->
<!-- Please add categories to the /doc subpage, and interwikis at Wikidata (see Wikipedia:Wikidata) -->
{{High-risk| 1230000+ }}
{{High-use|all-pages=yes}}
{{Lua|Module:Message box}}
{{Lua|Module:Message box}}
{{Mbox templates (small)}}
{{Mbox templates (small)}}


This is the {{tl|Ambox}} (['''A''']rticle ['''m''']essage ['''box''']) metatemplate.
{{tl|Ambox}} stands for '''A'''rticle '''m'''essage '''box''', which is a [[Help:Metatemplating|metatemplate]]. It is used to build message boxes for templates used in '''articles''', such as {{tl|underlinked}}. It offers several different colours, images and some other features.


It is used to build ''article message box'' templates such as {{tl|Underlinked}}. It offers several different colours, uses default images if no image parameter is given, and has some other features.
==Basic usage==
 
== Common parameters ==
The box below shows the most common parameters that are accepted by {{Tl|Ambox}}. The purpose of each is described below.
The box below shows the most common parameters that are accepted by {{Tl|Ambox}}. The purpose of each is described below.
<pre>
<pre style="overflow:auto;">
{{Ambox
{{Ambox
| name  =  
| name  =  
Line 28: Line 26:
</pre>
</pre>


==Full usage==
{{Hidden begin |title=Full parameters| titlestyle = background:palegreen;}}
The "All parameters" box shows all possible parameters for this template. However, it is not recommended to copy this, because it will never be required to use all parameters simultaneously.
{| class="wikitable" align="left" style="background:transparent; width=30%;"
!All parameters
|-
|<pre style="font-size:100%">
{{Ambox
| name        =
| subst      = <includeonly>{{subst:substcheck}}</includeonly>
| small      = {{{small|}}}
| type        =
| image      =
| imageright  =
| smallimage  =
| smallimageright =
| class      =
| style      =
| textstyle  =
| sect        = {{{1|}}}
| issue      =
| talk        = {{{talk|}}}
| fix        =
| date        = {{{date|}}}
| text        =
| smalltext  =
| plainlinks  = no
| removalnotice =
| cat        =
| all        =
| cat2        =
| all2        =
| cat3        =
| all3        =
}}
</pre>
|}
{{Hidden end}}
{{clear}}
==Common parameters==
=== ''name'' ===
=== ''name'' ===
The ''name'' parameter specifies the name of the template, without the Template namespace prefix. For example {{Tl|Underlinked}} specifies {{Para|name|Underlinked}}.
The ''name'' parameter specifies the name of the template, without the Template namespace prefix. For example {{Tl|Underlinked}} specifies {{Para|name|Underlinked}}.
Line 49: Line 88:
* For templates which should ''default to small'', try {{para|small|<nowiki>{{{small|left}}}</nowiki>}}. This will allow an editor to override by using {{para|small|no}} on an article.
* For templates which should ''default to small'', try {{para|small|<nowiki>{{{small|left}}}</nowiki>}}. This will allow an editor to override by using {{para|small|no}} on an article.


See {{sectionlink||sect}}, below, for information on how to limit {{para|small}} display to cases when the template is being used for a section instead of the whole article (recommended, to prevent inconsistent top-of-article display).
To use a small box that adjusts its width to match the text, use {{para|style|width: auto; margin-right: 0px;}} and {{para|textstyle|width: auto;}} together:
{{Ambox|nocat=true|small=left|style=width: auto; margin-right: 0px;|textstyle=width: auto; margin-right: 0px;|text=This is the small left-aligned Ambox format with flexible width.}}
 
See {{section link||sect}} below for more information on how to limit {{para|small}} display to cases when the template is being used for a section instead of the whole article (recommended, to prevent inconsistent top-of-article display).


=== ''type'' ===
=== ''type'' ===
Line 81: Line 123:
|nocat=true
|nocat=true
| type  = move
| type  = move
| text  = type=<u>move</u> – Merge, split and transwiki proposals, such as {{tl|split}} and {{tl|copy to Wiktionary}}.
| text  = type=<u>move</u> – Merge, split and transwiki proposals, such as {{tl|split}}.
}}
}}
{{Ambox
{{Ambox
Line 144: Line 186:


This parameter may then be used by an editor as follows:
This parameter may then be used by an editor as follows:
* {{para|talk|SECTION HEADING}} - the link will point to the specified section on the article's talk page, e.g. {{para|talk|Foo}}
* {{para|talk|SECTION HEADING}} the link will point to the specified section on the article's talk page, e.g. {{para|talk|Foo}}
* {{para|talk|FULL PAGE NAME}} - the template will link to the page specified (which may include a [[Help:Link#Section linking (anchors)|section anchor]]), e.g. {{para|talk|Talk:Banana#Foo}}
* {{para|talk|FULL PAGE NAME}} the template will link to the page specified (which may include a [[Help:Link#Section linking (anchors)|section anchor]]), e.g. {{para|talk|Talk:Banana#Foo}}


Notes:
Notes:
Line 179: Line 221:
The ''all'' parameter should not be linked, nor should the prefix <code>Category:</code> be used.
The ''all'' parameter should not be linked, nor should the prefix <code>Category:</code> be used.


== Other parameters ==
== Additional parameters ==
The box on the right shows all possible parameters for this template. However, it is not recommended to copy this, because it will never be required to use all parameters simultaneously.
{| class="wikitable" align="right" style="background:transparent; width=40%"
!All parameters
|-
|<pre style="font-size:90%; width=40%">
{{Ambox
| name        =
| subst      = <includeonly>{{subst:substcheck}}</includeonly>
| small      = {{{small|}}}
| type        =
| image      =
| imageright  =
| smallimage  =
| smallimageright =
| class      =
| style      =
| textstyle  =
| sect        = {{{1|}}}
| issue      =
| talk        = {{{talk|}}}
| fix        =
| date        = {{{date|}}}
| text        =
| smalltext  =
| plainlinks  = no
| cat        =
| all        =
| cat2        =
| all2        =
| cat3        =
| all3        =
}}<noinclude>
{{Documentation}}
</noinclude>
</pre>
|}
 
=== ''imageright'' ===
=== ''imageright'' ===
An image on the right side of the message box may be specified using this parameter. The syntax is the same as for the ''image'' parameter, except that the default is no image.
An image on the right side of the message box may be specified using this parameter. The syntax is the same as for the ''image'' parameter, except that the default is no image.
Line 224: Line 229:


=== ''class'' ===
=== ''class'' ===
A custom [[Cascading Style Sheets|CSS]] class to apply to the box.
Custom [[Cascading Style Sheets|CSS]] classes to apply to the box. If adding multiple classes, they should be space-separated.


=== ''style'' and ''textstyle'' ===
=== ''style'' and ''textstyle'' ===
Optional CSS values may be defined, without quotation marks <code>" "</code> but with the ending semicolons <code>;</code>.
Optional CSS values may be defined, without quotation marks <code>" "</code> but with the ending semicolons <code>;</code>.
* ''style'' specifies the style used by the entire message box table.
* ''style'' specifies the style used by the entire message box table. This can be used to do things such as modifying the width of the box.
* ''textstyle'' relates to the text cell.
* ''textstyle'' relates to the text cell.


Line 237: Line 242:


=== ''plainlinks'' ===
=== ''plainlinks'' ===
Normally on Wikipedia, external links have an arrow icon next to them, like this: [http://www.example.com Example.com]. However, in message boxes, the arrow icon is suppressed by default, like this: <span class="plainlinks">[http://www.example.com Example.com]</span>. To get the normal style of external link with the arrow icon, use {{para|plainlinks|no}}.
Normally on Wikipedia, external links have an arrow icon next to them, like this: [http://www.example.com Example.com]. However, in message boxes, the arrow icon is suppressed by default, like this: <span class="plainlinks">[http://www.example.com Example.com]</span>. To get the normal style of external link with the arrow icon, use {{para|plainlinks|no}}.


=== Additional categorisation parameters ===
=== ''cat2'', ''cat3'', ''all2'', and ''all3'' ===
* ''cat2'' and ''cat3'' provide additional monthly categories; see [[#cat]].
* ''cat2'' and ''cat3'' provide for additional monthly categories; see [[#cat]].
* ''all2'' and ''all3'' provide additional categories into which all articles are placed, just like [[#all]].
* ''all2'' and ''all3'' provide for additional categories into which all articles are placed, just like [[#all]].


== Technical notes ==
== Technical notes ==
* This meta-template uses the ambox CSS classes in [[MediaWiki:Common.css]]. The classes can also be used directly in a [[Help:Table|wikitable]] if special functionality is needed. See the [[Wikipedia:Ambox classes|how-to guide]] for that.
* The CSS for this template is defined by the ambox CSS classes in [[MediaWiki:Common.css]].
* If you need to use special characters in the text parameter then you need to escape them like this:
* If you need to use special characters in the text parameter then you need to escape them like this:
<pre>
<syntaxhighlight lang="xml">
{{Ambox
{{Ambox
|nocat=true
| text  = <div>
| text  = <div>
Equal sign = and a start and end brace { } work fine as they are.
Equal sign = and a start and end brace { } work fine as they are.
But here is a pipe &amp;#124; and two end braces &lt;nowiki>}}&lt;/nowiki>.
But here is a pipe &#124; and two end braces <nowiki>}}</nowiki>.
And now a pipe and end braces &lt;nowiki>|}}&lt;/nowiki>.
And now a pipe and end braces <nowiki>|}}</nowiki>.
</div>
</div>
}}
}}
</pre>
</syntaxhighlight>
{{Ambox
{{Ambox
|nocat=true
|nocat=true
Line 266: Line 271:


* The <code>&lt;div></code> tags that surround the text in the example above are usually not needed. But if the text contains line breaks then sometimes we get weird line spacing. This especially happens when using vertical dotted lists. Then use the div tags to fix that.
* The <code>&lt;div></code> tags that surround the text in the example above are usually not needed. But if the text contains line breaks then sometimes we get weird line spacing. This especially happens when using vertical dotted lists. Then use the div tags to fix that.
* This template uses CSS classes in [[MediaWiki:Common.css]] for most of its looks, thus it is fully skinnable.
* This template calls [[Module:Message box]] which holds most of the code for {{Tl|Ambox}}, while {{Tl|Ambox}} itself does parameter preprocessing.
* Internally, this meta-template uses HTML markup instead of wikimarkup for the table code. That is the usual way meta-templates are made, since wikimarkup has several drawbacks. For instance, it makes it harder to use [[m:Help:ParserFunctions|parser functions]] and some special characters in parameters.
* The default images for this meta-template are in png format instead of svg format. The main reason is that some older web browsers have trouble with the transparent background that MediaWiki renders for svg images. The png images here have hand optimised transparent background colour so they look good in all browsers. Note that svg icons only look somewhat bad in the old browsers, thus such hand optimisation is only worth the trouble for very widely used icons.
* The default images for this meta-template are in png format instead of svg format. The main reason is that some older web browsers have trouble with the transparent background that MediaWiki renders for svg images. The png images here have hand optimised transparent background colour so they look good in all browsers. Note that svg icons only look somewhat bad in the old browsers, thus such hand optimisation is only worth the trouble for very widely used icons.
* For more technical details see the [[Template talk:Ambox|talk page]] and the "See also" links below. Since this template works almost exactly like {{Tl|Tmbox}}, {{Tl|Imbox}}, {{Tl|Cmbox}} and {{Tl|Ombox}} their talk pages and related pages might also contain more details.
* For more technical details see the [[Template talk:Ambox|talk page]] and the "See also" links below. Since this template works almost exactly like {{Tl|Tmbox}}, {{Tl|Imbox}}, {{Tl|Cmbox}} and {{Tl|Ombox}} their talk pages and related pages might also contain more details.
==Display on mobile devices==
The MediaWiki developers have been conducted ongoing readability studies on ambox on the [https://en.m.wikipedia.org mobile version of Wikipedia]. Until further notice, code installed by the developers on the mobile version will generally override what we do here regarding the display and layout of this template. For more information, see [[:MW:Reading/Web/Projects/Mobile Page Issues]].
== TemplateData ==
{{collapse top|[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"params": {
"1": {},
"small": {
"label": "Small Mode",
"description": "The small parameter should be passed through the template, as this will allow editors to use the small format by specifying |small=left on an article.",
"type": "string",
"suggestedvalues": [
"no",
"left"
]
},
"talk": {},
"date": {},
"name": {
"label": "Template Name",
"description": "The name parameter specifies the name of the template, without the Template namespace prefix. ",
"type": "string"
},
"type": {},
"image": {},
"sect": {},
"issue": {},
"fix": {},
"subst": {},
"info": {},
"removalnotice": {},
"cat": {},
"all": {},
"imageright": {},
"class": {},
"text ": {},
"plainlinks": {},
"smallimage ": {},
"smallimageright": {},
"textstyle": {},
"style ": {},
"smalltext": {},
"cat2": {},
"cat3": {},
"all2": {},
"all3": {}
},
"paramOrder": [
"name",
"subst",
"small",
"type",
"image",
"sect",
"issue",
"fix",
"talk",
"date",
"1",
"info",
"removalnotice",
"cat",
"all",
"imageright",
"class",
"text ",
"plainlinks",
"smallimage ",
"smallimageright",
"textstyle",
"style ",
"smalltext",
"cat2",
"cat3",
"all2",
"all3"
]
}
</templatedata>
{{collapse bottom}}
== Mbox family ==
{{Mbox templates see also}}


== See also ==
== See also ==
{{Mbox templates see also}}
* [[Wikipedia:Manual of Style/Article message boxes]] – The style guideline for creating article message boxes.
Other pages:
* [[Wikipedia:Ambox CSS classes]] – Describes how to use the ambox CSS classes directly in [[Help:Table|wikitable]]s and [[HTML element#Tables|HTML tables]].
* [[Wikipedia:Article message boxes]] – The style guideline for creating article message boxes.
* [[Wikipedia talk:Article message boxes]] – For discussion about these matters.


<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<includeonly>{{sandbox other||
<!-- Categories go below this line, please; interwikis go to Wikidata, thank you! -->
<!-- Add categories below this line, and interwikis at Wikidata -->
[[Category:Article message templates| ]]
[[Category:Article message templates| ]]
[[Category:Mbox and messagebox templates]]
[[Category:Mbox and messagebox templates]]
[[Category:Exclude in print]]
}}</includeonly>
}}</includeonly>