Difference between revisions of "Template:Formatting error/doc"
imported>Amalthea (→See also: use parser function directly, avoid template) |
imported>Andrybak (use Template:Sandbox other) |
||
| Line 18: | Line 18: | ||
* [[mw:Help:Extension:ParserFunctions##iferror]] | * [[mw:Help:Extension:ParserFunctions##iferror]] | ||
| − | <includeonly> | + | <includeonly>{{Sandbox other|| |
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> | <!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> | ||
[[Category:Wikipedia metatemplates|{{PAGENAME}}]] | [[Category:Wikipedia metatemplates|{{PAGENAME}}]] | ||
| Line 24: | Line 24: | ||
[[id:Templat:FormattingError]] | [[id:Templat:FormattingError]] | ||
| − | </includeonly> | + | }}</includeonly> |
Latest revision as of 20:59, 31 March 2020
| This is a documentation subpage for Template:Formatting error. It contains usage information, categories and other content that is not part of the original template page. |
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