|
|
| Line 1: |
Line 1: |
| <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> | | {{Documentation subpage}} |
| {{Lua|Module:Error}}
| | <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> |
| {{TemplateBox
| |
| | 1 = 1
| |
| | 1label-en = message
| |
| | 1d-en = The error message to display
| |
| | 1aliases = message
| |
| | 1stat = required
| |
| | 1type = content
| |
|
| |
|
| | 2 = tag
| | === Usage === |
| | 2label-en = tag
| | Create a standard parser function error message. |
| | 2d-en = The HTML tag to wrap the error message in; one of “strong”, “span”, “div” and “p”
| |
| | 2def = strong
| |
| | 2stat = optional-
| |
| | 2type = line
| |
| | |
| | name = error
| |
| | desc-en = The template returns a ''state of error'' (recognized as such by a wiki [[Help:Parser function|parser function]]), and an ''error message text'' in red (visible for the user).{{clarify|date=August 2013|where is this used or why would one use this template?}}
| |
| | desc-td-en = The template returns a state of error (recognized as such by a wiki parser function), and an error message text in red (visible for the user).
| |
| | namespace = template
| |
| | usergroup = all
| |
| | |
| | seealso =
| |
| * [[Help:Parser function]]
| |
| * [[mw:Help:Extension:ParserFunctions##iferror:]]
| |
| * {{tl|Fact disputed}}
| |
| | |
| | i18n-method = -
| |
|
| |
|
| | print = line | | * {{tlx|error|An examplary error}} → {{error|An examplary error}} |
| | useTemplateData = only | | * {{tlx|error|An examplary error div|3=tag=div}} → {{error|An examplary error div|tag=div}} |
| }} | | * Compare: <nowiki>{{#expr:Invalid}}</nowiki> → {{#expr:Foo}} |
| | | * <nowiki>{{#iferror:{{error|Foo}} | {{y}} | {{n}} }}</nowiki> → {{#iferror:{{error|Foo}} | {{y}} | {{n}} }} |
| === Usage ===
| |
| * {{tlx|error|An exemplary error}} → {{error|An exemplary error}} | |
| * Compare, used in a Parser Function: <code><nowiki>{{#expr:Foo}}</nowiki></code> → {{#expr:Foo}} | |
| * <code><nowiki>{{#iferror:{{error|Foo}} | DFD | FDD }}</nowiki></code> → {{#iferror:{{error|Foo}} | DFD | FDD }} ''<small>{color green or red)</small>'' | |
| ===Tag option===
| |
| The tag to contain the error message can be given through the <code>tag</code> parameter, but it will only accept <code>span</code>, <code>div</code>, <code>p</code>, and <code>strong</code>, since those are the only tags recognized by the <code>#iferror</code> parser function. It defaults to <code>strong</code>, the tag generated e.g. by <code>#expre</code>. To prevent <code>strong</code> message, use one of the other tags, e.g. <code>tag=span</code>.
| |
|
| |
|
| * ABC {{tlx|error|An exemplary error demo no tag (default)}} XYZ → ABC {{error|An exemplary error demo no tag (default)}} XYZ
| | <includeonly> |
| * ABC <nowiki>{{error|An exemplary error demo span|tag=span}}</nowiki> XYZ → ABC {{error|An exemplary error demo span|tag=span}} XYZ
| | <!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> |
| * ABC <nowiki>{{error|An exemplary error demo div|tag=div}}</nowiki> XYZ → ABC {{error|An exemplary error demo div|tag=div}} XYZ
| | [[Category:Wikipedia metatemplates|{{PAGENAME}}]] |
| * ABC <nowiki>{{error|An exemplary error demo p|tag=p}}</nowiki> XYZ → ABC {{error|An exemplary error demo p|tag=p}} XYZ
| | </includeonly> |
| * ABC <nowiki>{{error|An exemplary error demo strong|tag=strong}}</nowiki> XYZ → ABC {{error|An exemplary error demo strong|tag=strong}} XYZ
| |
| <includeonly>{{Sandbox other|| | |
| <!-- Categories below this line; interwikis at Wikidata --> | |
| [[Category:Error message templates| ]] | |
| }}</includeonly>
| |
Usage
Create a standard parser function error message.
- {{error|An examplary error}} → An examplary error
- {{error|An examplary error div|tag=div}} →
An examplary error div
- Compare: {{#expr:Invalid}} → Expression error: Unrecognized word "foo".
- {{#iferror:{{error|Foo}} | {{y}} | {{n}} }} → Template:Y