Template:Notice box/Documentation

Template page
Revision as of 17:49, 12 August 2016 by Thumper (talk | contribs) (Created template documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This template creates a notice box. Usually you won't want to use this template directly. Instead, it is intended to be used by other templates to create customized notices.

For example:

  • {{notice}}: General purpose notice box template
  • The template documentation box is also a notice box

Notice boxes are much more disruptive than section notes, so you shouldn't use them as part of the regular text of a page. They are more for things you really want to jump out at the reader, like warnings.

Usage

{{notice box
 | title   = <title text>
 | content = <content>
}}

<title> is the text that will be used for the title of the notice box.

<content> is what will be placed in the content area of the notice box.

By default the notice box is presented with a cyan background, and an exclamation mark icon to the left of the title. The icon is generated via {{notice icon|❢|royalblue}}.

For example, {{notice box|title=Notice|content=This is the content.}} gives:

{{❢}} Notice
This is the content.

(Note that if you're doing the above, it would be simpler to just do: {{notice|This is the content.}}.)

Optional arguments

icon

You can change the icon used in a notice box with the icon argument. Anything you use will replace the default icon.

You will probably want to use {{notice icon}} to create your icon.

For example:

{{notice box
 | title   = Looks like rain!
 | icon    = {{notice icon|☔|blue}}
 | content = Hope you brought your umbrella!
}}

Produces:

{{☔}} Looks like rain!
Hope you brought your umbrella!

background

By default the background of the notice box is cyan. But you can set it to any colour with background. Any colour format recognized by Cascading Style Sheets can be used.

For example:

{{notice box
 | title      = Yarrr!
 | icon       = {{notice icon|☠}}
 | background = #ccc
 | content    = Well, blow me down!

There be pirates here!
}}

Produces:

{{☠}} Yarrr!

Well, blow me down!

There be pirates here!

Notes

You will almost never want to use this template directly in pages. {{notice}} does pretty much everything you need for general notices, and is easier to use. This template is best used to create custom notice types.

Because of the nature of wiki markup, you have to be careful about how you format your content text. Normally when you have two lines of text separated by a single newline, they get joined into a single paragraph:

This is line 1.
This is line 2.

produces:

This is line 1. This is line 2.

That works in the content of a notice box... except for the last line:

{{notice box
 | title   = Title
 | content = This is line 1.
This is line 2.

This is line 3.
This is line 4.

This is line 5.
This is line 6.
}}

Produces:

{{❢}} Title

This is line 1. This is line 2.

This is line 3. This is line 4.

This is line 5.

This is line 6.

Notice that lines 5 and 6 are separated into two paragraphs.

To prevent this, you can do:

{{notice box
 | title   = Title
 | content = This is line 1.
This is line 2.

This is line 3.
This is line 4.

This is line 5.
This is line 6.

<nowiki/>}}

to get:

{{❢}} Title

This is line 1. This is line 2.

This is line 3. This is line 4.

This is line 5. This is line 6.

But as you can see, it creates extra space at the bottom.

The only real solution is to simply make sure the last paragraph in your notice box content is all on a single line. It's a pain the ass, sure, but... it's all you can do.