Template:Error/doc
m (una revisione importata) |
Versione attuale delle 22:52, 4 nov 2012
{{#ifeq: error/doc | doc
|
{{
#ifeq: show | show | {{ {{#switch: {{#if: | | {{#if: | {{#ifeq:| | talk | }} | {{#ifeq:template|discussioni template | talk | template }} }} }}
| main | = ambox | talk = tmbox | user = ombox | wikipedia = ombox | file | image = imbox | mediawiki = ombox | template = ombox | help = ombox | category = cmbox | portal = ombox | book = ombox | other | #default = ombox
}}
| type = notice
| image = 40px
| imageright =
| class =
| style =
| textstyle =
| text = This is a documentation subpage for Template:Error/doc.
It contains usage information, categories, interlanguage links and other content that is not part of the original {{ #if: | {{{text2}}} | {{ #if: | {{{text1}}} | {{ #ifeq: Template | Utente | template template page | {{ #if: Template |template page|article}}}}}}}}.
| small =
| smallimage =
| smallimageright =
| smalltext =
| subst =
| date =
| name =
}}
}}{{ #if: | | {{#ifexist:Template:Error/doc|[[Category:{{ #switch: Template | Template = Template | User = User | #default = Wikipedia }} documentation pages]]|}} }}
| }}
The template returns a state of error (recognized as such by a wiki parser function), and optionally an error-message text in red (visible for the user).
Usage
|An exemplary error }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → <{{#switch:{{{tag}}}
|p=p |span=span |div=div |#default=strong
}} class="error">An exemplary error</{{#switch:{{{tag}}}
|p=p |span=span |div=div |#default=strong
}}>
- Compare, used in a Parser Function:
{{#expr:Foo}}
→ {{#expr:Foo}} -
{{#iferror:{{error|Foo}} | {{y}} | {{n}} }}
→ {{#iferror:<{{#switch:{{{tag}}}
|p=p |span=span |div=div |#default=strong
}} class="error">Foo</{{#switch:{{{tag}}}
|p=p |span=span |div=div |#default=strong
}}> | 13px | Template:N }}
Tag option
The tag to contain the error message can be given through the tag
parameter, but it will only accept span
, div
, p
, and strong
, since those are the only tags recognized by the #iferror
parser function. It defaults to strong
, the tag generated e.g. by #expre
. To prevent strong
message, use one of the other tags, e.g. tag=span
.
|An exemplary error demo no tag (default) }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} XYZ → ABC <{{#switch:{{{tag}}}
|p=p |span=span |div=div |#default=strong
}} class="error">An exemplary error demo no tag (default)</{{#switch:{{{tag}}}
|p=p |span=span |div=div |#default=strong
}}> XYZ
- ABC {{error|An exemplary error demo span|tag=span}} XYZ → ABC <{{#switch:span
|p=p |span=span |div=div |#default=strong
}} class="error">An exemplary error demo span</{{#switch:span
|p=p |span=span |div=div |#default=strong
}}> XYZ
- ABC {{error|An exemplary error demo div|tag=div}} XYZ → ABC <{{#switch:div
|p=p |span=span |div=div |#default=strong
}} class="error">An exemplary error demo div</{{#switch:div
|p=p |span=span |div=div |#default=strong
}}> XYZ
- ABC {{error|An exemplary error demo p|tag=p}} XYZ → ABC <{{#switch:p
|p=p |span=span |div=div |#default=strong
}} class="error">An exemplary error demo p</{{#switch:p
|p=p |span=span |div=div |#default=strong
}}> XYZ
- ABC {{error|An exemplary error demo strong|tag=strong}} XYZ → ABC <{{#switch:strong
|p=p |span=span |div=div |#default=strong
}} class="error">An exemplary error demo strong</{{#switch:strong
|p=p |span=span |div=div |#default=strong
}}> XYZ
See also