Difference between revisions of "Template:Formatting error"

From blackwiki
Jump to navigation Jump to search
imported>SkyLined
m (+No category for "Wikipedia talk")
imported>Amalthea
(Switch to use {{error}}, trying it with an anchor again, made namespace switch more robust against future changes)
Line 1: Line 1:
<includeonly><span style="color:red" id="FormattingError">{{{1|Error in template}}}</span>{{#switch:{{NAMESPACE}}
+
<includeonly><a name="FormattingError" id="FormattingError"/>{{Error|{{{1|Error in template}}}}}<!--
|User=
+
-->{{#switch:{{NAMESPACE}}
|User talk=
+
    | {{ns:User}}
|Talk=
+
    | {{ns:User talk}}
|Wikipedia talk=
+
    | {{ns:Talk}}
|#default=[[Category:Pages with incorrect formatting templates use|{{PAGENAME}}]]
+
    | {{ns:Wikipedia talk}} =
}}</includeonly>
+
    | #default = [[Category:Pages with incorrect formatting templates use|{{PAGENAME}}]]
<noinclude>{{documentation}}</noinclude>
+
}}</includeonly><noinclude>
 +
 
 +
{{documentation}}
 +
</noinclude>

Revision as of 12:55, 27 May 2009


50px Template documentation[view] [edit] [history] [purge]

Outputs an error message in red into the page and adds the page to Category:Pages with incorrect formatting templates use. An anchor (FormattingError) is inserted at the start of the error message, so you can find any errors on a page easily by adding #FormattingError at the end of the URL (e.g. Template:val/test#FormattingError). Used in complex templates that check their arguments for validity, so incorrect use can be spotted while editing a page or afterwards.

Usage

  • {{FormattingError|error message}}

or

  • {{FormattingError|error message|nocategory=true}}

When using the nocategory argument, the error message is displayed as usual, but the page is not added to Category:Pages with incorrect formatting templates use. This is useful in documentation pages for templates that use FormattingError and show what errors they can generate without adding these documentation pages to the category. For an example of this, see {{LinkForElement}}.

This template can be evaluated using the {{#iferror}} parser function:

  • {{#iferror:{{val|XX}}|error|OK}}OK

See also

id:Templat:FormattingError