Difference between revisions of "Template:Imbox/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>WOSlinker
(sync)
imported>Edokter
(Sync)
Line 40: Line 40:
 
| <tr><td colspan={{#if:{{{imageright|}}}|3|2}} class="mbox-text" style="{{{textstyle|}}}"> {{{below}}} </td></tr>
 
| <tr><td colspan={{#if:{{{imageright|}}}|3|2}} class="mbox-text" style="{{{textstyle|}}}"> {{{below}}} </td></tr>
 
}}
 
}}
</table><noinclude>
+
</table><!-- Detect and report usage with faulty "type" parameter:
 +
-->{{#switch:{{{type|}}}
 +
|  <!-- No type fed, is also valid input -->
 +
| speedy
 +
| delete
 +
| content
 +
| style
 +
| move
 +
| protection
 +
| license
 +
| featured
 +
| notice    =    <!-- Do nothing, valid "type" -->
 +
| #default  = <div style="text-align: center;">This message box is using an invalid "type={{{type|}}}" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|{{main other|Main:}}{{FULLPAGENAME}}]]<!-- Sort on namespace -->
 +
}}<!--
  
=== Sandbox for {{tl|imbox}} ===
+
--><includeonly>{{#ifeq:{{BASEPAGENAME}}|{{SUBPAGENAME}}|{{#ifeq:{{NAMESPACE}}|Template|[[Category:File message boxes]]}}}}</includeonly><!--
  
Here we can test new code versions.
+
--><noinclude>
 
 
The box above is template code on this page, the boxes below are transclusions of this page and show how that code renders when the box is stacked. If you have updated the code above then you have to {{purge|purge this page}} to see the effect on the examples below.
 
 
 
{{imbox/sandbox
 
| type = speedy
 
| text = speedy
 
}}
 
{{imbox/sandbox
 
| type = delete
 
| text = delete
 
}}
 
[[Image:Canis lupus laying.jpg|thumb|60px]]
 
{{imbox/sandbox
 
| type = content
 
| text = content, lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
 
| imageright = [[Image:Nuvola apps bookcase.svg|40x40px]]
 
}}
 
{{imbox/sandbox
 
| type = style
 
| text = style, lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
 
| imageright = [[Image:Nuvola apps bookcase.svg|40x40px]]
 
}}
 
{{imbox/sandbox
 
| type = notice
 
| text = notice, lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
 
| imageright = [[Image:Nuvola apps bookcase.svg|80px]]
 
}}
 
{{imbox/sandbox
 
| type = move
 
| text = move
 
}}
 
{{shortcut|WP:TEST}}
 
{{imbox/sandbox
 
| type = protection
 
| text = protection
 
}}
 
 
 
Some text just to test bottom margin.
 
 
 
=== Special ===
 
 
 
Some other parameter combinations.
 
 
 
{{imbox/sandbox
 
| text  = No type and no image given ('''default''')
 
}}
 
 
 
{{imbox/sandbox
 
| image = none
 
| text  = No type and '''image=none''' – No image is used and the '''text''' uses the whole message box area.
 
}}
 
 
 
{{imbox/sandbox
 
| type = license
 
| image = [[Image:Imbox license.svg|40px]] <br> [[Image:Ambox warning yellow.svg|40px]]
 
| imageright = [[Image:Shuttle.svg|30px]]
 
| text  = type = license <br> image = <nowiki>[[Image:Imbox license.svg|40px]] &lt;br> [[Image:Ambox warning yellow.svg|40px]]</nowiki> <br> imageright = <nowiki>[[Image:Shuttle.svg|30px]]</nowiki>
 
}}
 
 
 
{{imbox/sandbox
 
| type = license
 
| image = [[Image:Imbox license.svg|40px]] <br> [[Image:Ambox warning yellow.svg|40px]]
 
| imageright = [[Image:Shuttle.svg|30px]]
 
| text  = '''This file is in the [[public domain]] because it was created by [[NASA]].'''
 
<br>Note that use of NASA logos, insignia and emblems are restricted per US law.
 
}}
 
 
 
{{imbox/sandbox
 
| image =
 
| text  = image =
 
}}
 
 
 
{{imbox/sandbox
 
| image = [[Image:Nuvola apps bookcase.svg|100px]]
 
| text  = Trying large left side image. - lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
 
}}
 
 
 
{{imbox/sandbox
 
| image = [[Image:Nuvola apps bookcase.svg|100px]]
 
| text  = Trying large left side image. - lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
 
| imageright = [[Image:Nuvola apps bookcase.svg|100px]]
 
}}
 
 
 
{{imbox/sandbox
 
| image = none
 
| text  = No type and '''image=none'''
 
}}
 
 
 
=== Parameters ===
 
 
 
List of all parameters:
 
 
 
<pre>
 
{{imbox/sandbox
 
| type  = speedy / delete / content / style / notice /
 
          move / protection / license / featured
 
| image = none / [[Image:Some image.svg|40px]]
 
| imageright = [[Image:Some image.svg|40px]]
 
| style = CSS value
 
| textstyle = CSS value
 
| text  = The message body text.
 
| below = More text or another imbox.
 
}}
 
</pre>
 
 
 
=== Examples of varying width ===
 
 
 
{{imbox/sandbox
 
| type      = license
 
| image      = [[Image:Imbox license.svg|40px]]
 
| text      =
 
This file has been released into the '''[[w:public domain|public domain]]''' by the [[w:Copyrights|copyright]] holder, its copyright has expired, or it is ineligible for copyright. This applies worldwide.
 
}}
 
 
 
{{imbox/sandbox
 
| type      = license
 
| image      = [[Image:Heckert GNU white.svg|52px|GFDL]]
 
| text      =
 
Permission is granted to copy, distribute and/or modify this document under the terms of the '''[[Wikipedia:Text of the GNU Free Documentation License|GNU Free Documentation License]]''', Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 
}}
 
 
 
{{imbox/sandbox
 
| type      = license
 
| image      = [[Image:CC some rights reserved.svg|90px|Creative Commons License]] <br> [[Image:Cc-by new white.svg|24px|Creative Commons Attribution icon]][[Image:Cc-sa white.svg|24px|Creative Commons Share Alike icon]]
 
| imageright = [[Image:Flag of Germany.svg|64px|right|Flag of Germany]]
 
| text      =
 
''This image is licensed under the [[Creative Commons]] [http://creativecommons.org/licenses/by-sa/2.0/de/deed.en Attribution ShareAlike License v. 2.0] '''as written for [[Germany|German]] law''' (which may or may not be entirely compatible with versions for other countries).''
 
}}
 
 
 
Note: The Creative Commons box above has more padding around the "Some rights reserved" image since that image itself has a lot of whitespace. To fix that the image should be modified, not imbox.
 
 
 
=== Testing the below parameter ===
 
 
 
These examples relies on CSS code in [[MediaWiki:Common.css]] to make them 100% wide instead of 80% wide when inside another imbox. That is, when an imbox is fed as the "below" parameter to another imbox.
 
 
 
With a left image:
 
 
 
{{imbox/sandbox
 
| type      = license
 
| image      = [[Image:Imbox license.svg|40px]]
 
| text      =
 
This file has been released into the '''[[w:public domain|public domain]]''' by the [[w:Copyrights|copyright]] holder, its copyright has expired, or it is ineligible for copyright. This applies worldwide.
 
| below =
 
  {{imbox/sandbox
 
  | type = content
 
<!--  | style = margin: 0 -0.5em; -->
 
  | text = '''This license tag is deprecated!'''
 
  }}
 
}}
 
 
 
With both a left and right image:
 
 
 
{{imbox/sandbox
 
| type      = license
 
| image      = [[Image:CC some rights reserved.svg|90px|Creative Commons License]] <br> [[Image:Cc-by new white.svg|24px|Creative Commons Attribution icon]][[Image:Cc-sa white.svg|24px|Creative Commons Share Alike icon]]
 
| imageright = [[Image:Flag of Germany.svg|64px|right|Flag of Germany]]
 
| text      =
 
''This image is licensed under the [[Creative Commons]] [http://creativecommons.org/licenses/by-sa/2.0/de/deed.en Attribution ShareAlike License v. 2.0] '''as written for [[Germany|German]] law''' (which may or may not be entirely compatible with versions for other countries).''
 
| below =
 
  {{imbox/sandbox
 
  | type = content
 
<!--  | style = margin: 0 -0.5em; -->
 
  | text = '''This license tag is deprecated!'''
 
  }}
 
}}
 
 
 
With no images:
 
 
 
{{imbox/sandbox
 
| type      = license
 
| image      = none
 
| text      =
 
This file has been released into the '''[[w:public domain|public domain]]''' by the [[w:Copyrights|copyright]] holder, its copyright has expired, or it is ineligible for copyright. This applies worldwide.
 
| below =
 
  {{imbox/sandbox
 
  | type = content
 
<!--  | style = margin: 0 -0.5em; -->
 
  | text = '''This license tag is deprecated!'''
 
  }}
 
}}
 
 
 
=== Testing mbox-inside ===
 
 
 
These examples relies on that the surrounding template has the "mbox-inside" class and CSS code in [[MediaWiki:Common.css]] to make imboxes 100% wide instead of 80% wide when inside another template.
 
 
 
{{information
 
| Description = Testing imboxes inside the {{tl|information}} template.
 
| Source =
 
  {{imbox/sandbox
 
  | type = notice
 
  | text = Now is full width instead of 80% width.
 
  }}
 
| Author = David Göthberg
 
| Permission =
 
  {{imbox/sandbox
 
  | type = notice
 
  | text = Now is full width instead of 80% width.
 
  }}
 
}}
 
  
 +
{{documentation}}
 +
<!-- Add categories and interwikis to the /doc subpage, not here! -->
 
</noinclude>
 
</noinclude>

Revision as of 10:39, 30 November 2011

50px Template documentation[view] [edit] [history] [purge]
Message box
meta-templates
templatecontext
{{Ambox}}article
{{Cmbox}}category
{{Imbox}}image
{{Tmbox}}talk
{{Fmbox}}footer / header
{{Ombox}}other pages
{{Mbox}}auto-detect
{{Asbox}}article stub
{{Dmbox}}disambiguation

This is the {{Imbox}} ([I]mage [m]essage [box]) metatemplate.

It is used to build message box templates for file (image) pages, such as {{cleanup-image}} etc. It offers several different colours, uses default images if no image parameter is given and it has some other features.

This template works almost exactly like {{Ambox}} and uses the same parameters.

Usage

Simple usage example:

{{Imbox |text=Some text.}}

Complex example:

{{Imbox
| type = style
| style = width:400px;
| image = [[File:Emblem-question-yellow.svg|40px]]
| textstyle = font-style:italic; font-weight:bold; color:red; 
| text = The message body text.
}}

Image message box types

The following examples use different type parameters but use no image parameters thus they use the default images for each type.

Other images

The default images shown above are mostly for convenience. In many cases it is more appropriate to use more specific images. These examples use the image parameter to specify an image other than the default images.

Special

Some other parameter combinations.

Parameters

List of all parameters:

{{Imbox
| name = name of the template
| type  = speedy / delete / content / style / notice / 
          move / protection / license / featured
| image = none / [[File:Some image.svg|40px]]
| imageright = [[File:Some image.svg|40px]]
| style = CSS value
| textstyle = CSS value
| text  = The message body text.
| below = More text or another imbox.
| plainlinks = no
}}

name

(Optional) Name of the template. This adds a CSS class with name box-name to the HTML element, for use by bots or scripts.

type

If no type parameter is given the template defaults to type notice. That means it gets a blue 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:Gnome-dev-camera.svg|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.png|40px]]
Anything = Any other object that you want to show on the right side.

style

An optional CSS value used by the entire message box table. Without quotation marks " ". For example:
style = margin-bottom: 0.5em;

textstyle

An optional CSS value used by the text cell. For example:
textstyle = text-align: center;

text

The message body text.

below

A full width area below the images and text area. Can take a text or any kind of object, for instance another imbox:
below = {{Imbox |type=content |text=This license tag is deprecated.}}

plainlinks

Defaults to yes. If external link arrows - 10px - are desired, specify:
plainlinks = no

Technical details

Namespace "Image:" was renamed to "File:" on 11 December 2008. This template was created long before that, and that is why it is named "imbox" as in "image message box".

If you need to use special characters in the text parameter then you need to escape them like this:

{{Imbox
| 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>
}}

This template uses the imbox CSS classes in MediaWiki:Common.css for most of its looks, thus it is fully skinnable.

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.

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 png images. For those older browsers these png images have been modified so that the color of their default backgrounds match the background color of the template. The default background that MediaWiki renders for svg images is always white. This creates a white box around the images when displayed in older browsers.

For more technical details see the talk page. Since this template works almost exactly like the other mboxes their talk pages and related pages might also contain more details, see the "See also" section below.

See also

There are seven metatemplates in the Module:Message box family:
  • {{Ambox}}, for messageboxes on article pages.
  • {{Cmbox}}, for messageboxes on category pages.
  • {{Imbox}}, for messageboxes on file (image) pages.
  • {{Tmbox}}, for messageboxes on talk pages.
  • {{Fmbox}}, for header and footer messageboxes.
  • {{Ombox}}, for messageboxes on other types of page.
  • {{Mbox}}, for messageboxes that are used in different namespaces and change their presentation accordingly.

Closely related metatemplates:

  • {{Asbox}}, for messageboxes in article stubs.
  • {{Dmbox}}, for messageboxes on disambiguation or set-index pages.
  • {{Ivmbox}}, a simple full-width box with default ivory background intended to frame important messages or notices.

Templates intended to be used in conjunction with Mboxes: