Template:WarningBox: Difference between revisions

From Zandronum Wiki
No edit summary
No edit summary
Tag: Source edit
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
This is a simple warning box.
<div style="float: right">__TOC__</div>
 
== Template data ==
<templatedata>
{
"params": {
"border": {
"label": "Border colour",
"description": "Hex colour value for the border",
"type": "line",
"default": "000000"
},
"background": {
"label": "Background colour",
"description": "Hex colour value for the background",
"type": "line",
"default": "FFFFFF"
},
"color": {
"label": "Text colour",
"description": "Hex colour value for the text",
"type": "line",
"default": "000000"
},
"image": {
"label": "Image",
"description": "Image file name",
"type": "wiki-file-name",
"suggested": true
},
"content": {
"label": "Content",
"description": "Wikitext content of the warning box",
"type": "content",
"required": true
},
"imagesize": {
"label": "Image size",
"description": "Pixel size of the image - this affects both width and height",
"type": "number",
"default": "46"
},
"imagelink": {
"label": "Image link",
"description": "Link the user will be sent to upon clicking the image",
"type": "url"
},
"wikitable": {
"label": "Wikitable",
"description": "Use the wikitable class for the warning box. Disables all colour parameters.",
"type": "boolean",
"default": "false"
},
"textalign": {
"label": "Text alignment",
"description": "Text alignment of the content. One of: left, center, right",
"type": "line",
"default": "center"
}
},
"format": "block",
"description": "A highly customisable warning box",
"paramOrder": [
"content",
"image",
"imagelink",
"imagesize",
"wikitable",
"color",
"background",
"border",
"textalign"
]
}
</templatedata>


== Examples ==
== Examples ==
=== No custom header ===
<ol>
{{WarningBox|Hello, there!}}
<li>
=== Custom header ===
<pre><nowiki>{{WarningBox
{{WarningBox|Hello, there!|Greeting}}
| content = Test
}}</nowiki></pre>
becomes
{{WarningBox
| content = Test
}}
</li>
 
<li>
<pre><nowiki>{{WarningBox
| image = Unkna0.png
| content = Test
| background = EFEFEF
}}</nowiki></pre>
becomes
{{WarningBox
| image = Unkna0.png
| content = Test
| background = EFEFEF
}}
</li>
 
<li>
<pre><nowiki>{{WarningBox
| image = Za exe2 logo cropped.png
| content = <- Click that image to view the page [[Zandronum]]
| imagelink = Zandronum
}}</nowiki></pre>
becomes
{{WarningBox
| image = Za exe2 logo cropped.png
| content = <- Click that image to view the page [[Zandronum]]
| imagelink = Zandronum
}}
</li>
 
<li>
<pre><nowiki>{{WarningBox
| image = Za exe2 logo cropped.png
| content = This article documents a [[Zandronum]]-specific [[ACS]] feature which may not be supported by [[doomwiki:ZDoom|ZDoom]] and its other child ports.
| background = F0FFD1
| border = 41443A
| color = 000000
}}</nowiki></pre>
becomes
{{WarningBox
| image = Za exe2 logo cropped.png
| content = This article documents a [[Zandronum]]-specific [[ACS]] feature which may not be supported by [[doomwiki:ZDoom|ZDoom]] and its other child ports.
| background = F0FFD1
| border = 41443A
| color = 000000
}}
</li>


== The template itself==
<li>
</noinclude><div style='background-color: khaki; border: 1px solid darkkhaki; padding: 0 5px;'>
<pre><nowiki>{{WarningBox
<div style='border-bottom: 1px solid darkkhaki;'>
| content = This article is a stub.
<strong>{{#if:{{{2|}}}|{{{2}}}|Warning}}</strong>
| wikitable = true
</div>
| textalign = left
<div>
}}</nowiki></pre>
<table>
becomes
<tr>
{{WarningBox
<td class='za-no-mobile'>
| content = This article is a stub.
[[File:Unkna0.png]]
| wikitable = true
</td>
| textalign = left
<td style='padding-left: 5px;'>
}}
{{{1}}}
</li>
</td>
</ol>
</tr>
</noinclude><includeonly>{| align="center" border=0 cellpadding=4 cellspacing=4 {{#ifeq: {{{wikitable|}}} | true | class="wikitable" style=" | style="border: solid 1px #{{#if: {{{border|}}} | {{{border}}} | 000000}}; background-color: #{{#if: {{{background|}}} | {{{background}}} | FFFFFF}}; color: #{{#if: {{{color|}}} | {{{color}}} | 000000}}; }} padding: 0.4em 1em; width: 75%; margin: 1em auto; text-align: {{#if: {{{textalign|}}} | {{{textalign}}} | center}}; border-radius: 3px"
</table>
|-
</div>
| style="border:none; width: {{#if: {{{imagesize|}}} | {{{imagesize}}} | 46}}px; {{#if: {{{image|}}} | | display:none}}" | {{#if: {{{image|}}} | [[File:{{{image}}}|{{#if: {{{imagesize|}}} | {{{imagesize}}} | 46}}x{{#if: {{{imagesize|}}} | {{{imagesize}}} | 46}}px|link={{{imagelink|}}}]] }}
</div>
| style="border: none" | {{{content}}}
|}</includeonly>

Latest revision as of 04:20, 3 January 2023

Template data

A highly customisable warning box

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Contentcontent

Wikitext content of the warning box

Contentrequired
Imageimage

Image file name

Filesuggested
Image linkimagelink

Link the user will be sent to upon clicking the image

URLoptional
Image sizeimagesize

Pixel size of the image - this affects both width and height

Default
46
Numberoptional
Wikitablewikitable

Use the wikitable class for the warning box. Disables all colour parameters.

Default
false
Booleanoptional
Text colourcolor

Hex colour value for the text

Default
000000
Lineoptional
Background colourbackground

Hex colour value for the background

Default
FFFFFF
Lineoptional
Border colourborder

Hex colour value for the border

Default
000000
Lineoptional
Text alignmenttextalign

Text alignment of the content. One of: left, center, right

Default
center
Lineoptional

Examples

  1. {{WarningBox
    | content = Test
    }}

    becomes

    Test
  2. {{WarningBox
    | image = Unkna0.png
    | content = Test
    | background = EFEFEF
    }}

    becomes

    Test
  3. {{WarningBox
    | image = Za exe2 logo cropped.png
    | content = <- Click that image to view the page [[Zandronum]]
    | imagelink = Zandronum
    }}

    becomes

    <- Click that image to view the page Zandronum
  4. {{WarningBox
    | image = Za exe2 logo cropped.png
    | content = This article documents a [[Zandronum]]-specific [[ACS]] feature which may not be supported by [[doomwiki:ZDoom|ZDoom]] and its other child ports.
    | background = F0FFD1
    | border = 41443A
    | color = 000000
    }}

    becomes

    This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.
  5. {{WarningBox
    | content = This article is a stub.
    | wikitable = true
    | textalign = left
    }}

    becomes

    This article is a stub.