Difference between revisions of "Template:Formatting error"
imported>MSGJ m (moved Template:FormattingError to Template:Formatting error: remove camelcase) |
imported>MSGJ (show output of template) |
||
| Line 1: | Line 1: | ||
| − | + | <span id="FormattingError" />{{Error|{{{1|Error in template}}}}}{{#switch:{{NAMESPACE}} | |
|{{ns:Talk}} | |{{ns:Talk}} | ||
|{{ns:User}} | |{{ns:User}} | ||
| Line 5: | Line 5: | ||
|{{ns:Wikipedia talk}}=<!-- page in namespaces not to be listed in the category --> | |{{ns:Wikipedia talk}}=<!-- page in namespaces not to be listed in the category --> | ||
|#default={{#if:{{{nocategory|}}}||[[Category:Pages with incorrect formatting templates use|{{PAGENAME}}]]}} | |#default={{#if:{{{nocategory|}}}||[[Category:Pages with incorrect formatting templates use|{{PAGENAME}}]]}} | ||
| − | }} | + | }}<noinclude> |
| + | {{documentation}} | ||
| + | </noinclude> | ||
Revision as of 11:17, 24 February 2011
Error in template
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
- Category:Pages with incorrect formatting templates use for a list of pages that have been marked as using a formatting template incorrectly using this template.
- {{Error-small}}
- {{Error}}
- mw:Help:Extension:ParserFunctions##iferror
| The above documentation is transcluded from Template:Formatting error/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |