This site is supported by donations to The OEIS Foundation.
Template:Warning
From OeisWiki
The following documentation is located at Template:Warning/doc. [<Edit> Template:Warning/doc]
[Purge Template:Warning]
[Purge Template:Warning]
The {{warning}} OEIS Wiki metatemplate returns a state of warning (with HTML attribute class="warning" given to one of four choices of HTML tags, and optionally a user-friendly warning message text (in italic orange by default).
Usage
[edit]{{#iferror: warning | {{no}} An error! | {{yes}} Not an error! }}
Not an error!
{{#iferror: error | {{no}} An error! | {{yes}} Not an error! }}
Not an error!
{{warning}}This is a warning! {{#iferror: {{warning}} | {{no}} An error! | {{yes}} Not an error! }}
Not an error!
{{error}}An error occurred! {{#iferror: {{error}} | {{no}} An error! | {{yes}} Not an error! }}
An error!
{{warning| A typical warning: You're lucky! }}A typical warning: You're lucky! {{#iferror: {{warning| A typical warning: You're lucky! }} | {{no}} An error! | {{yes}} Not an error! }}
Not an error!
{{error| A typical error: Too bad! }}A typical error: Too bad! {{#iferror: {{error| A typical error: Too bad! }} | {{no}} An error! | {{yes}} Not an error! }}
An error!
With parser function: {{#expr: 9+3 }}12 {{#iferror: {{#expr: 9+3 }} | {{no}} An error! | {{yes}} Not an error! }}
Not an error!
With parser function: {{#expr: Foo }}Expression error: Unrecognized word "foo". {{#iferror: {{#expr: Foo }} | {{no}} An error! | {{yes}} Not an error! }}
An error!
Tag option
[edit]The HTML tag to contain the warning message can be given through the tag parameter, but it will only accept div, p, span and strong. It defaults to span. To prevent the use of the span default tag, use one of the other tags, e.g. tag = p.
{{warning|A typical warning demo (default tag: span)}} A typical warning demo (default tag: span) {{warning|An exemplary warning demo (span tag)|tag = span}} An exemplary warning demo (span tag) {{warning|An exemplary warning demo (strong tag)|tag = strong}} An exemplary warning demo (strong tag) {{warning|An exemplary warning demo (p tag)|tag = p}} An exemplary warning demo (p tag)
{{warning|An exemplary warning demo (div tag)|tag = div}} An exemplary warning demo (div tag)
Code
[edit]<noinclude>{{documentation}}</noinclude><includeonly>''<{{#switch: {{lc: {{{tag|}}} }}
| div = div
| p = p
| strong = strong
| #default = span
}} class="warning" style="color: orange; font-size: 1.25em;">{{{message|{{{1|This is a warning!}}}}}}</{{#switch: {{lc: {{{tag|}}} }}
| div = div
| p = p
| strong = strong
| #default = span
}}>''</includeonly>
Code suggestion for {{if warning}}
[edit]If we ever need a {{if warning}} template, here's the code suggestion:
<noinclude>{{Documentation}}</noinclude><includeonly><!--
-->{{#if: {{#pos: {{{1|}}} | class{{=}}"warning" }}
| {{{2|}}}
| {{{3|}}}
}}</includeonly>
Tests:
:{{#if: {{#pos: {{warning}} | class{{=}}"warning" }}
| {{yes}} Warning!
| {{no}} No warning.
}}
:{{#if: {{#pos: {{error}} | class{{=}}"warning" }}
| {{yes}} Warning!
| {{no}} No warning.
}}
yields
Warning!
No warning.
See also
[edit]- {{error}} to return an error message and a state of error (with HTML attribute
class="error") - {{if error}} to return different values depending on whether a state of error (with HTML attribute
class="error") is given within its first argument (see Code suggestion for{{if error}}) #iferrorparser function extension (cf. MediaWiki external link below)
- {{warning}} to return a warning message and a state of warning (with HTML attribute
class="warning") - {{if warning}} to return different values depending on whether a state of warning (with HTML attribute
class="warning") is given within its first argument (see Code suggestion for{{if warning}}) - There is no
#ifwarningparser function extension, but the above suggested template may be implemented for that purpose.