13,212
edits
m (Test for valid box type and style; etc) |
(Moving off a few things to templates) |
||
Line 1: | Line 1: | ||
{{#switch: <!-- Is the box type and box style parameters valid? (Show stopper) | {{#switch: <!-- Is the box type and box style parameters valid? (Show stopper) | ||
-->{{#switch: {{{box|top}}} <!-- Checking box | -->{{#switch: {{{box|top}}} <!-- Checking box format parameter --> | ||
| box | | box | ||
| section | | section | ||
Line 31: | Line 31: | ||
}} | }} | ||
| box not ok, = | | box not ok, = | ||
invalid box | invalid box format! | ||
| style not ok = | | style not ok = | ||
invalid box style! | invalid box style! | ||
| box not ok,style not ok = | | box not ok,style not ok = | ||
box | box format and style invalid! | ||
| #default = | | #default = | ||
box | box format and style valid | ||
}} | }} | ||
{| class="wikitable" <!-- Begin box --> | {| class="wikitable" <!-- Begin box --> | ||
| | | | ||
{{#switch: {{lc: {{{box|top}}} }} <!-- What | {{#switch: {{lc: {{{box|top}}} }} <!-- What box format? --> | ||
| box = | | box = | ||
box | box | ||
Line 49: | Line 49: | ||
| top | | top | ||
| #default = | | #default = | ||
{{#ifeq: {{lc: {{{box|top}}} }} | top <!-- Is there an unspecified or valid | {{#ifeq: {{lc: {{{box|top}}} }} | top <!-- Is there an unspecified or valid box format specified? --> | ||
| <!-- Yes, the type of box is unspecified or a valid type of box is specified --> | | <!-- Yes, the type of box is unspecified or a valid type of box is specified --> | ||
top | top | ||
| <!-- No, an invalid type of box is specified --> | | <!-- No, an invalid type of box is specified --> | ||
invalid box | invalid box format! | ||
}} | }} | ||
}};<!-- | }};<!-- | ||
Line 77: | Line 77: | ||
invalid box style! | invalid box style! | ||
}} | }} | ||
}}; | }};{{User:Johan G/Messagebox/box content | ||
| title = {{{title|}}} | |||
| text = {{{text|}}} | |||
| style = {{{style|}}} | |||
| one-liner = {{{one-liner|}}} | |||
| image = {{{image|}}} | |||
| image-width = {{{image-width|}}} | |||
| box = {{{box|top}}} | |||
| text-style = {{{text-style|}}} | |||
| image-style = {{{image-style|}}} | |||
}} | |||
|}<!-- End box | |}<!-- End box | ||
Line 151: | Line 111: | ||
<nowiki>|</nowiki> text = | <nowiki>|</nowiki> text = | ||
<nowiki>|</nowiki> ''style'' = | <nowiki>|</nowiki> ''style'' = | ||
<nowiki>|</nowiki> ''one-liner'' = | <nowiki>|</nowiki> ''one-liner'' = | ||
<nowiki>|</nowiki> ''image'' = | <nowiki>|</nowiki> ''image'' = | ||
<nowiki>|</nowiki> ''image-width'' = | <nowiki>|</nowiki> ''image-width'' = | ||
< | <nowiki>|</nowiki> ''box'' = | ||
<nowiki>|</nowiki> ''box-style'' = | <nowiki>|</nowiki> ''box-style'' = | ||
<nowiki>|</nowiki> ''image-style'' = | |||
<nowiki>|</nowiki> ''text-style'' = | <nowiki>|</nowiki> ''text-style'' = | ||
<nowiki>|</nowiki> ''page'' = | <nowiki>|</nowiki> ''page'' = | ||
Line 169: | Line 126: | ||
=== Main parameters === | === Main parameters === | ||
;title: Optional alternative title for the messagebox that will be shown in bold, for example '''Danger''', '''Warning''', '''Caution''', '''Cleanup''', '''Note''', '''Notice''', '''Tip''', '''Hint''', '''Protected''' etc. Defaults to '''Notice'''. | ; title: Optional alternative title for the messagebox that will be shown in bold, for example '''Danger''', '''Warning''', '''Caution''', '''Cleanup''', '''Note''', '''Notice''', '''Tip''', '''Hint''', '''Protected''', '''Nominated for deletion''' etc. Defaults to '''Notice'''. | ||
;text: Text to be shown in the messagebox. | ; text: Text to be shown in the messagebox. | ||
=== Parameters affecting the appearance === | === Parameters affecting the appearance === | ||
Optional parameters affecting the appearance of the messagebox. | Optional parameters affecting the appearance of the messagebox. | ||
; style: Style of the messagebox. Valid values are '''speedy''', '''warning''', '''caution''', '''notice''', '''tip''', '''protected''' and '''neutral'''. Defaults to '''notice'''. | |||
;style: Style of the messagebox. Valid values are '''speedy''', '''warning''', '''caution''', '''notice''', '''tip''', '''protected''' and '''neutral'''. Defaults to '''notice'''. | |||
;one-liner: Makes the messagebox a one-liner if not empty. | ; one-liner: Makes the messagebox a one-liner if not empty. | ||
;image: Image or icon to use excluding the '''File:''' namespace prefix, for example '''Cleanup.png'''. Instead of an image name a shortcut can be used. When using the shortcuts the icons will automatically get the right colour for the style. Valid icon shortcuts are: '''/!\''', '''(!)''', '''(?)''', '''(i)''', '''(x)''' and '''U''' (for padlock). | ; image: Image or icon to use excluding the '''File:''' namespace prefix, for example '''Cleanup.png'''. Instead of an image name a shortcut can be used. When using the shortcuts the icons will automatically get the right colour for the style. Valid icon shortcuts are: '''/!\''', '''(!)''', '''(?)''', '''(i)''', '''(x)''' and '''U''' (for padlock). | ||
;image-width: Width of the image in pixels. Defaults to 40 pixels or for one-liners 24 pixels. | ; image-width: Width of the image in pixels. Defaults to 40 pixels or for one-liners 24 pixels. | ||
; box: Will override the box format. Valid values are '''box''', '''top''' and '''section'''. The defaults are '''box''' for the talk namespaces and the category namespace, and '''top''' for any other namespace. | |||
=== CSS Style parameters === | === CSS Style parameters === | ||
Optional parameters allowing cascading style sheet (CSS) style attributes to be used. These will override the style of the messagebox. Use sparingly and only when needed. | Optional parameters allowing cascading style sheet (CSS) style attributes to be used. These will override the style of the messagebox. Use sparingly and only when needed. | ||
;box-style: CSS attributes applied to the box. | ; box-style: CSS attributes applied to the box. | ||
;text-style: CSS attributes applied to the text cell. | ; text-style: CSS attributes applied to the text cell. | ||
;image-style: CSS attributes applied to the image cell. | ; image-style: CSS attributes applied to the image cell. | ||
=== Parameters for demonstration and testing === | === Parameters for demonstration and testing === | ||
Optional parameters for demonstration and testing. | Optional parameters for demonstration and testing. | ||
;page: Wiki page. Use <code><nowiki>page = {{{page|}}}</nowiki></code> to forward this behaviour to a template. | ; page: Wiki page. Use <code><nowiki>page = {{{page|}}}</nowiki></code> to forward this behaviour to a template. | ||
;nocat: If '''nocat=true''' pages are not categorized, if '''nocat=false''' pages are always categorized, and if '''nocat''' is empty or undefined only pages in the template namespace are categorised. | ; nocat: If '''nocat=true''' pages are not categorized, if '''nocat=false''' pages are always categorized, and if '''nocat''' is empty or undefined only pages in the template namespace are categorised. | ||
: Do ''not'' forward this parameter to a template for category suppression, instead use the techniques discussed in [[#Category suppression|Category suppression]] below. | : Do ''not'' forward this parameter to a template for category suppression, instead use the techniques discussed in [[#Category suppression|Category suppression]] below. | ||
Line 222: | Line 176: | ||
== Related templates == | == Related templates == | ||
* [[User:Johan G/Messagebox/box content]] | * [[User:Johan G/Messagebox/box content]] | ||
* [[User:Johan G/Messagebox/icon]] | |||
* [[User:Johan G/Messagebox/box format]] | * [[User:Johan G/Messagebox/box format]] | ||
* [[User:Johan G/Messagebox/box style]] | * [[User:Johan G/Messagebox/box style]] |