Template:Ambox/doc: Difference between revisions

(cat)
No edit summary
Line 4: Line 4:
It is used to build ''article message box'' templates such as {{tl|wikify}}. It offers several different colours, uses default images if no image parameter is given and it has some other features.
It is used to build ''article message box'' templates such as {{tl|wikify}}. It offers several different colours, uses default images if no image parameter is given and it has some other features.


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 CSS classes|how-to guide]] for that.
This meta-template uses the ambox CSS classes in [[MediaWiki:Common.css]]. The classes can also be used directly in a [[wp:Help:Table|wikitable]] if special functionality is needed. See the [[Wikipedia:Ambox CSS classes|how-to guide]] for that.


=== Usage ===
=== Usage ===
Line 116: Line 116:
| image = [[File:Gnome globe current event.svg|42px|alt=Clock over a larger globe]]
| image = [[File:Gnome globe current event.svg|42px|alt=Clock over a larger globe]]
| imageright = [[File:Shuttle.svg|20px|link=|alt=]]
| imageright = [[File:Shuttle.svg|20px|link=|alt=]]
| text  = '''This article or section documents a current [[spaceflight]].'''
| text  = '''This article or section documents a current [[wp:spaceflight|spaceflight]].'''
<br>Content may change as the mission progresses.
<br>Content may change as the mission progresses.
}}
}}
Line 145: Line 145:


'''subst'''
'''subst'''
This should be used in order to detect when the template has been incorrectly substituted. Such pages will be placed in [[:Category:Pages with incorrectly substituted templates]]
This should be used in order to detect when the template has been incorrectly substituted. Such pages will be placed in [[wp:Category:Pages with incorrectly substituted templates|Category:Pages with incorrectly substituted templates]]


'''type'''
'''type'''
Line 153: Line 153:
:'''No parameter''' = If no '''image''' parameter is given the template uses a default image. Which default image it uses depends on the '''type''' parameter.
:'''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. Widths of 40px - 50px are usually about right. (Images over 52 pixels wide will cause padding problems.)
:'''An image''' = Should be an image with usual wiki notation. Widths of 40px - 50px are usually about right. (Images over 52 pixels wide will cause padding problems.)
:: Often an icon is [[Wikipedia:Alternative text for images#Purely decorative images|purely decorative]] in the W3C sense that it repeats the text. To improve [[Wikipedia:Accessibility|accessibility]], it is desirable to not have it be announced by [[screen reader]]s, as well as to avoid it linking to an irrelevant page. If (and only if) the image license allows this, it can be marked with "{{para|link}}{{para|alt}}". For example:
:: Often an icon is [[Wikipedia:Alternative text for images#Purely decorative images|purely decorative]] in the W3C sense that it repeats the text. To improve [[Wikipedia:Accessibility|accessibility]], it is desirable to not have it be announced by [[wp:screen reader|screen reader]]s, as well as to avoid it linking to an irrelevant page. If (and only if) the image license allows this, it can be marked with "<code>|link=</code><code>|alt=</code>". For example:
:::<code><nowiki>image = [[File:Unbalanced scales.svg|40px|link=|alt=]]</nowiki></code>
:::<code><nowiki>image = [[File:Unbalanced scales.svg|40px|link=|alt=]]</nowiki></code>
:: Conversely, an icon that does not use "{{para|link}}{{para|alt}}", and which therefore is announced to visually impaired readers, should use an "{{para|alt|<var>[[Wikipedia:Alternative text for images|alt text]]</var>}}" parameter that describes the icon. With no {{para|link}} parameter (using the default link), the alt text should describe the icon's visual appearance. For example:
:: Conversely, an icon that does not use "<code>|link=</code><code>|alt=</code>", and which therefore is announced to visually impaired readers, should use an "<code>|alt=<var>[[Wikipedia:Alternative text for images|alt text]]</var></code>" parameter that describes the icon. With no <code>|link=</code> parameter (using the default link), the alt text should describe the icon's visual appearance. For example:
:::<code><nowiki>image = [[File:Gnome globe current event.svg|40px|alt=Clock over a larger globe]]</nowiki></code>
:::<code><nowiki>image = [[File:Gnome globe current event.svg|40px|alt=Clock over a larger globe]]</nowiki></code>
:: With a nonempty "{{para|link|<var>Page</var>}}" the alt text should describe the icon's function. For example:
:: With a nonempty "<code>|link=<var>Page</var></code>" the alt text should describe the icon's function. For example:
:::<code><nowiki>image = [[File:Purple question mark.svg|40px|link=Special:Random|alt=Random article]]</nowiki></code>
:::<code><nowiki>image = [[File:Purple question mark.svg|40px|link=Special:Random|alt=Random article]]</nowiki></code>
:: An icon whose license requires attribution may have alt text, but ''must keep the default link''. Although public domain images do not require a link, many licenses do require one. Please see ''[[Wikipedia:Alternative text for images#Purely decorative images|Purely decorative images]]'' for more information about licensing.
:: An icon whose license requires attribution may have alt text, but ''must keep the default link''. Although public domain images do not require a link, many licenses do require one. Please see ''[[Wikipedia:Alternative text for images#Purely decorative images|Purely decorative images]]'' for more information about licensing.
Line 170: Line 170:


'''style'''
'''style'''
:Optional [[Cascading Style Sheets|CSS]] values used by the entire message box table. Without quotation marks <code>" "</code> but with the ending semicolons <code>;</code>. For example:
:Optional [[wp:Cascading Style Sheets|CSS]] values used by the entire message box table. Without quotation marks <code>" "</code> but with the ending semicolons <code>;</code>. For example:
::<code>style = margin-bottom: 0.5em;</code>
::<code>style = margin-bottom: 0.5em;</code>


'''textstyle'''
'''textstyle'''
:Optional [[Cascading Style Sheets|CSS]] values used by the text cell. For example:
:Optional [[wp:Cascading Style Sheets|CSS]] values used by the text cell. For example:
::<code>textstyle = text-align: center;</code>
::<code>textstyle = text-align: center;</code>


Line 258: Line 258:
This template calls {{tl|ambox/core}} which holds most of the code for {{tl|ambox}}, while {{tl|ambox}} itself does parameter preprocessing.
This template calls {{tl|ambox/core}} which holds most of the code for {{tl|ambox}}, while {{tl|ambox}} itself does parameter preprocessing.


Internally this meta-template uses HTML wikimarkup instead of wikimarkup for the table code. That is the usual way we make meta-templates since wikimarkup has several drawbacks. For instance it makes it harder to use [[m:Help:ParserFunctions|parser functions]] and some special characters in parameters.
Internally this meta-template uses HTML wikimarkup instead of wikimarkup for the table code. That is the usual way we make meta-templates since wikimarkup has several drawbacks. For instance it makes it harder to use [http://meta.wikimedia.org/wiki/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 [[wp: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.


=== See also ===
=== See also ===
{{Mbox templates see also}}
* [[:Category:Message Box Templates]]


Other pages:
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:Ambox CSS classes]] – Describes how to use the ambox CSS classes directly in [[wp:Help:Table|wikitable]]s and [[wp:HTML element#Tables|HTML tables]].
* [[Wikipedia:Article message boxes]] – The style guideline for creating article message boxes.
* [[Wikipedia:Article message boxes]] – The style guideline for creating article message boxes.
* [[Wikipedia talk:Article message boxes]] – For discussion about these matters.
* [[wp:Wikipedia talk:Article message boxes|Wikipedia talk:Article message boxes]] – For discussion about these matters.


<includeonly>
<includeonly>