Editing Template:Ambox/doc

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page is not enabled for semantic in-text annotations due to namespace restrictions. Details about how to enable the namespace can be found on the configuration help page.

Latest revision Your text
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
<!-- Please add categories to the /doc subpage, and interwikis at Wikidata (see Wikipedia:Wikidata) -->
+
<!-- Categories go where indicated at the bottom of this page, please; interwikis go to Wikidata (see also: [[Wikipedia:Wikidata]]) -->
{{High-use|all-pages=yes}}
+
{{High-risk| approximately 1300000 }}
 
{{Lua|Module:Message box}}
 
{{Lua|Module:Message box}}
 
{{Mbox templates (small)}}
 
{{Mbox templates (small)}}
  
{{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.
+
This is the {{tl|Ambox}} (['''A''']rticle ['''m''']essage ['''box''']) metatemplate.
  
==Basic usage==
+
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.
 +
 
 +
== 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 style="overflow:auto;">
+
<pre>
 
{{Ambox
 
{{Ambox
 
| name  =  
 
| name  =  
Line 26: Line 28:
 
</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 88: Line 49:
 
* 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.
  
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:
+
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).
{{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 123: Line 81:
 
|nocat=true
 
|nocat=true
 
| type  = move
 
| type  = move
| text  = type=<u>move</u> – Merge, split and transwiki proposals, such as {{tl|split}} and {{tl|merge}}.
+
| text  = type=<u>move</u> – Merge, split and transwiki proposals, such as {{tl|split}} and {{tl|copy to Wiktionary}}.
 
}}
 
}}
 
{{Ambox
 
{{Ambox
Line 172: Line 130:
  
 
When the template is in its compact form (when placed inside {{tl|multiple issues}}) or small form (when using {{para|small|left}}), the ''issue'' is the only text that will be displayed. For example, {{Tl|Citation style}} defines
 
When the template is in its compact form (when placed inside {{tl|multiple issues}}) or small form (when using {{para|small|left}}), the ''issue'' is the only text that will be displayed. For example, {{Tl|Citation style}} defines
* <syntaxhighlight lang="text" inline>|issue=This article '''has an unclear citation style'''.</syntaxhighlight>
+
* <code>|issue=<nowiki>This article '''has an unclear citation style'''.</nowiki></code>
* <syntaxhighlight lang="text" inline>|fix=The references used may be made clearer with a different or consistent style of [[Wikipedia:Citing sources|citation]], [[Wikipedia:Footnotes|footnoting]], or [[Wikipedia:External links|external linking]].</syntaxhighlight>
+
* <code>|fix=<nowiki>The references used may be made clearer with a different or consistent style of [[Wikipedia:Citing sources|citation]], [[Wikipedia:Footnotes|footnoting]], or [[Wikipedia:External links|external linking]].</nowiki></code>
  
 
When used stand-alone it produces the whole text:
 
When used stand-alone it produces the whole text:
Line 186: Line 144:
  
 
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 221: Line 179:
 
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.
  
== Additional parameters ==
+
== Other parameters ==
 +
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="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
 +
| removalnotice =
 +
| cat        =
 +
| all        =
 +
| cat2        =
 +
| all2        =
 +
| cat3        =
 +
| all3        =
 +
}}<noinclude>
 +
{{Documentation}}
 +
</noinclude>
 +
</pre>
 +
|}
 +
{{clear}}
 +
 
 
=== ''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 229: Line 227:
  
 
=== ''class'' ===
 
=== ''class'' ===
Custom [[Cascading Style Sheets|CSS]] classes to apply to the box. If adding multiple classes, they should be space-separated.
+
A custom [[Cascading Style Sheets|CSS]] class to apply to the box.
  
 
=== ''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. This can be used to do things such as modifying the width of the box.
+
* ''style'' specifies the style used by the entire message box table.
 
* ''textstyle'' relates to the text cell.
 
* ''textstyle'' relates to the text cell.
  
Line 242: Line 240:
  
 
=== ''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}}.
  
Line 249: Line 248:
  
 
== 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.
 
* 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:
<syntaxhighlight lang="xml">
+
<pre>
 
{{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 &#124; and two end braces <nowiki>}}</nowiki>.
+
But here is a pipe &amp;#124; and two end braces &lt;nowiki>}}&lt;/nowiki>.
And now a pipe and end braces <nowiki>|}}</nowiki>.
+
And now a pipe and end braces &lt;nowiki>|}}&lt;/nowiki>.
 
</div>
 
</div>
 
}}
 
}}
</syntaxhighlight>
+
</pre>
 
{{Ambox
 
{{Ambox
 
|nocat=true
 
|nocat=true
Line 270: Line 269:
  
 
* 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==
+
== See also ==
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}}
 
{{Mbox templates see also}}
 +
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.
  
== See also ==
+
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
* [[Wikipedia:Manual of Style/Article message boxes]] – The historical style guideline for creating article message boxes.
+
<!-- Categories go below this line, please; interwikis go to Wikidata, thank you! -->
 
 
<includeonly>{{sandbox other||
 
<!-- 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>

Please note that all contributions to Yugipedia are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 International License (see Yugipedia:Licensing for more details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)
Preview page with this template
Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above.

View this template

Templates used on this page:

This page is a member of 1 hidden category: