Difference between revisions of "Template:CheckElement"
Jump to navigation
Jump to search
imported>SkyLined (Created from other Category:Nuclide_templates helper templates to help fix an issue.) |
imported>SkyLined (Remove extra }} that prevented the template from working correctly.) |
||
| Line 133: | Line 133: | ||
|uuo|ununoctium= | |uuo|ununoctium= | ||
|#default=[[Category:Pages with incorrect nuclide templates use]]{{FormattingError|Error in [[Template:WrapLinkForElement]]: unknown element {{{1}}}.|nocategory={{{nocategory|}}}}} | |#default=[[Category:Pages with incorrect nuclide templates use]]{{FormattingError|Error in [[Template:WrapLinkForElement]]: unknown element {{{1}}}.|nocategory={{{nocategory|}}}}} | ||
| − | + | }}</includeonly> | |
Revision as of 09:02, 18 September 2009
Template that returns an error message if the first argument is not valid for use with other nuclide templates helper templates.
Usage
When using a string that is not a valid element name or symbol or "x" or "element", an error message is returned, like so:
{{CheckElement|C}}will return ""{{CheckElement|Carbon}}will return ""{{CheckElement|Blablabla}}will return "Error in Template:WrapLinkForElement: unknown element Blablabla."
The "link=yes" argument is also supported; if the element name or symbol has no associated link, an error message is returned, like so:
{{CheckElement|link=yes|C}}will return ""{{CheckElement|link=yes|Carbon}}will return ""{{CheckElement|link=yes|X}}will return ""
When using a common name for an element that goes against the Wikipedia style guide for element names, a warning message will be returned. There are currently three such names:
{{CheckElement|Aluminum}}will return "Error in Template:WrapLinkForElement: Aluminum is not a valid way to spell aluminium"{{CheckElement|Sulphur}}will return "Error in Template:WrapLinkForElement: Sulphur is not a valid way to spell sulfur"{{CheckElement|Cesium}}will return "Error in Template:WrapLinkForElement: Cesium is not a valid way to spell caesium"
This template can be used in other templates to check for error before calling other templates that require a valid element or symbol like so:
{{#if:{{CheckElement|{{{element argument}}}|link={{{link|}}} }}
| Error message (shown when the element is invalid).
| Normal message (shown when the element is valid).
}}
See also
Template:Periodic table templates
| The above documentation is transcluded from Template:CheckElement/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. |