Template:Warning: Difference between revisions

From Artisans Asylum Wiki
(a warning template)
 
(Template code cleanup and simplification)
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Mbox
{| class="warningbox"
| name      = Warning
! [[File:OOjs_UI_icon_notice-destructive.png|20px|alt=Warning|link=]] !! class="warningbox-text" | {{{text}}}
| demospace  = {{{demospace|}}}
|-
| style      = {{#if:{{{style|}}} |{{{style}}} }}
|  
| subst      = <includeonly>{{subst:substcheck}}</includeonly>
|}
| type      = content
 
| image      = {{#if:{{{image|}}}| [[File:{{{image}}}|{{{imagesize|40px}}}|Warning]] }}
<noinclude>
| small      = {{{small|}}}
==Warning Template==
| smallimage = {{#if:{{{image|}}}| [[File:{{{image}}}|30px|Warning]]}}
The following displays the warning icon and the word "Warning: " followed by the included text.
| imageright = {{#if:{{{imageright|}}} |{{{imageright}}} |{{#if:{{{shortcut|{{{shortcut1|}}}}}} |{{Ombox/shortcut|{{{shortcut|{{{shortcut1|}}}}}}|{{{shortcut2|}}}|{{{shortcut3|}}}|{{{shortcut4|}}}|{{{shortcut5|}}}}}}} }}
 
| textstyle  = {{{textstyle|text-align: {{#if:{{{center|}}}|center|{{{align|left}}}}};}}}
Wiki code:
| text      = {{#if:{{{header|{{{heading|{{{title|}}}}}}}}} |<div style="{{{headstyle|text-align: {{#if:{{{center|}}}|center|left}};}}}">'''{{{header|{{{heading|{{{title|}}}}}}}}}'''</div>}}<!--
 
             -->{{{text|{{{content|{{{reason|{{{1}}}}}}}}}}}}
<nowiki>{{warning|text=</nowiki>Don't do that!<nowiki>}}</nowiki>  
}}<noinclude>
 
<!-- Add categories to the /doc subpage; interwikis go to Wikidata. -->
{{warning|text=Don't do that!}}
{{Documentation}}
 
==Example==
 
Here is a longer example.
 
Wiki code:
 
<nowiki>{{warning|text=</nowiki> Here is a long warning, which is sufficiently wordy to run onto a second line (unless you have a really large screen!), which would normally cause it to wrap round the icon, but because we passed it as a parameter it keeps its left alignment straight.<nowiki>}}</nowiki>
 
 
{{warning|text=Here is a long warning, which is sufficiently wordy to run onto a second line (unless you have a really large screen!), which would normally cause it to wrap round the icon, but because we passed it as a parameter it keeps its left alignment straight.}}
 
(This is a subset of the [https://www.mediawiki.org/wiki/Template:Warning MediaWiki Warning Template])
 
<templatedata>
{
    "description": "Adds a warning box to a page.",
    "params": {
        "text": {
            "label": "Warning message",
            "type": "string",
            "required": true,
            "description": "Warning message (i.e. \"Look out below!\")",
             "aliases": ["1"]
        }
    }
}
</templatedata>
 
</noinclude>
</noinclude>

Latest revision as of 13:46, 2 February 2024

Warning {{{text}}}


Warning Template

The following displays the warning icon and the word "Warning: " followed by the included text.

Wiki code:

{{warning|text=Don't do that!}} 
Warning Don't do that!


Example

Here is a longer example.

Wiki code:

{{warning|text= Here is a long warning, which is sufficiently wordy to run onto a second line (unless you have a really large screen!), which would normally cause it to wrap round the icon, but because we passed it as a parameter it keeps its left alignment straight.}} 


Warning Here is a long warning, which is sufficiently wordy to run onto a second line (unless you have a really large screen!), which would normally cause it to wrap round the icon, but because we passed it as a parameter it keeps its left alignment straight.


(This is a subset of the MediaWiki Warning Template)

Adds a warning box to a page.

Template parameters

ParameterDescriptionTypeStatus
Warning messagetext 1

Warning message (i.e. "Look out below!")

Stringrequired