Difference between revisions of "Template:CheckElement"
Jump to navigation
Jump to search
imported>SkyLined (Remove "Error in Template:WrapLinkForElement: " from errors and added checking for links with "link" argument) |
imported>Headbomb (tweak code real estate + remove redundancy) |
||
| Line 5: | Line 5: | ||
Normally, the code for the template is included, but this template is too complex to do that. | Normally, the code for the template is included, but this template is too complex to do that. | ||
--></noinclude><includeonly>{{#switch:{{lc:{{{1}}}}} | --></noinclude><includeonly>{{#switch:{{lc:{{{1}}}}} | ||
| − | | | + | |x|element={{#ifeq:{{lc:{{{link|}}} }} |
| − | | | + | |yes |
| − | | | + | |[[Category:Pages with incorrect nuclide templates use]]<!-- |
| − | |cesium=[[Category:Pages with incorrect nuclide templates use]]{{FormattingError| | + | -->{{FormattingError |
| − | + | |The generic element '{{{1}}}' does not have a page to link to. | |
| − | + | |nocategory={{{nocategory|}}} | |
| − | |mu|muonium= | + | }} |
| − | |h|hydrogen= | + | }} |
| − | |d|deuterium= | + | |aluminum |
| − | |t|tritium= | + | |sulphur |
| − | |he|helium= | + | |cesium=[[Category:Pages with incorrect nuclide templates use]]<!-- |
| − | |li|lithium= | + | -->{{FormattingError |
| − | |be|beryllium= | + | |{{{1}}} is not a [[Wikipedia:WikiProject_Chemicals/Style_guidelines#Element_names|valid]]<!-- |
| − | |b|boron= | + | --> way to spell {{{#switch:{{lc:{{{1}}}}}} |
| − | |c|carbon= | + | |alumimum=aluminium |
| − | |n|nitrogen= | + | |sulphur=sulfur |
| − | |o|oxygen= | + | |cesium=caesium |
| − | |f|fluorine= | + | }} |
| − | |ne|neon= | + | |nocategory={{{nocategory|}}} |
| − | |na|sodium= | + | }} |
| − | |mg|magnesium= | + | |mu|muonium= |
| − | |al|aluminium= | + | |h|hydrogen= |
| − | |si|silicon= | + | |d|deuterium= |
| − | |p|phosphorus= | + | |t|tritium= |
| − | |s|sulfur= | + | |he|helium= |
| − | |cl|chlorine= | + | |li|lithium= |
| − | |ar|argon= | + | |be|beryllium= |
| − | |k|potassium= | + | |b|boron= |
| − | |ca|calcium= | + | |c|carbon= |
| − | |sc|scandium= | + | |n|nitrogen= |
| − | |ti|titanium= | + | |o|oxygen= |
| − | |v|vanadium= | + | |f|fluorine= |
| − | |cr|chromium= | + | |ne|neon= |
| − | |mr|manganese= | + | |na|sodium= |
| − | |fe|iron= | + | |mg|magnesium= |
| − | |co|cobalt= | + | |al|aluminium= |
| − | |ni|nickel= | + | |si|silicon= |
| − | |cu|copper= | + | |p|phosphorus= |
| − | |zn|zinc= | + | |s|sulfur= |
| − | |ga|gallium= | + | |cl|chlorine= |
| − | |ge|germanium= | + | |ar|argon= |
| − | |as|arsenic= | + | |k|potassium= |
| − | |se|selenium= | + | |ca|calcium= |
| − | |br|bromine= | + | |sc|scandium= |
| − | |kr|krypton= | + | |ti|titanium= |
| − | |rb|rubidium= | + | |v|vanadium= |
| − | |sr|strontium= | + | |cr|chromium= |
| − | |y|yttrium= | + | |mr|manganese= |
| − | |zr|zirconium= | + | |fe|iron= |
| − | |nb|niobium= | + | |co|cobalt= |
| − | |mo|molybdenum= | + | |ni|nickel= |
| − | |tc|technetium= | + | |cu|copper= |
| − | |ru|ruthenium= | + | |zn|zinc= |
| − | |rh|rhodium= | + | |ga|gallium= |
| − | |pd|palladium= | + | |ge|germanium= |
| − | |ag|silver= | + | |as|arsenic= |
| − | |cd|cadmium= | + | |se|selenium= |
| − | |in|indium= | + | |br|bromine= |
| − | |sn|tin= | + | |kr|krypton= |
| − | |sb|antimony= | + | |rb|rubidium= |
| − | |te|tellurium= | + | |sr|strontium= |
| − | |i|iodine= | + | |y|yttrium= |
| − | |xe|xenon= | + | |zr|zirconium= |
| − | |cs|caesium= | + | |nb|niobium= |
| − | |ba|barium= | + | |mo|molybdenum= |
| − | |la|lanthanum= | + | |tc|technetium= |
| − | |ce|cerium= | + | |ru|ruthenium= |
| − | |pr|praseodymium= | + | |rh|rhodium= |
| − | |nd|neodymium= | + | |pd|palladium= |
| − | |pm|promethium= | + | |ag|silver= |
| − | |sm|samarium= | + | |cd|cadmium= |
| − | |eu|europium= | + | |in|indium= |
| − | |gd|gadolinium= | + | |sn|tin= |
| − | |tb|terbium= | + | |sb|antimony= |
| − | |dy|dysprosium= | + | |te|tellurium= |
| − | |ho|holmium= | + | |i|iodine= |
| − | |er|erbium= | + | |xe|xenon= |
| − | |tm|thulium= | + | |cs|caesium= |
| − | |yb|ytterbium= | + | |ba|barium= |
| − | |lu|lutetium= | + | |la|lanthanum= |
| − | |hf|hafnium= | + | |ce|cerium= |
| − | |ta|tantalum= | + | |pr|praseodymium= |
| − | |w|tungsten= | + | |nd|neodymium= |
| − | |re|rhenium= | + | |pm|promethium= |
| − | |os|osmium= | + | |sm|samarium= |
| − | |ir|iridium= | + | |eu|europium= |
| − | |pt|platinum= | + | |gd|gadolinium= |
| − | |au|gold= | + | |tb|terbium= |
| − | |hg|mercury= | + | |dy|dysprosium= |
| − | |tl|thallium= | + | |ho|holmium= |
| − | |pb|lead= | + | |er|erbium= |
| − | |bi|bismuth= | + | |tm|thulium= |
| − | |po|polonium= | + | |yb|ytterbium= |
| − | |at|astatine= | + | |lu|lutetium= |
| − | |rn|radon= | + | |hf|hafnium= |
| − | |fr|francium= | + | |ta|tantalum= |
| − | |ra|radium= | + | |w|tungsten= |
| − | |ac|actinium= | + | |re|rhenium= |
| − | |th|thorium= | + | |os|osmium= |
| − | |pa|protactinium= | + | |ir|iridium= |
| − | |u|uranium= | + | |pt|platinum= |
| − | |np|neptunium= | + | |au|gold= |
| − | |pu|plutonium= | + | |hg|mercury= |
| − | |am|americium= | + | |tl|thallium= |
| − | |cm|curium= | + | |pb|lead= |
| − | |bk|berkelium= | + | |bi|bismuth= |
| − | |cf|californium= | + | |po|polonium= |
| − | |es|einsteinium= | + | |at|astatine= |
| − | |fm|fermium= | + | |rn|radon= |
| − | |md|mendelevium= | + | |fr|francium= |
| − | |no|nobelium= | + | |ra|radium= |
| − | |lr|lawrencium= | + | |ac|actinium= |
| − | |rf|rutherfordium= | + | |th|thorium= |
| − | |db|dubnium= | + | |pa|protactinium= |
| − | |sg|seaborgium= | + | |u|uranium= |
| − | |bh|bohrium= | + | |np|neptunium= |
| − | |hs|hassium= | + | |pu|plutonium= |
| − | |mt|meitnerium= | + | |am|americium= |
| − | |ds|darmstadtium= | + | |cm|curium= |
| − | |rg|roentgenium= | + | |bk|berkelium= |
| − | |uub|ununbium= | + | |cf|californium= |
| − | |uut|ununtrium= | + | |es|einsteinium= |
| − | |uuq|ununquadium= | + | |fm|fermium= |
| − | |uup|ununpentium= | + | |md|mendelevium= |
| − | |uuh|ununhexium= | + | |no|nobelium= |
| − | |uus|ununseptium= | + | |lr|lawrencium= |
| − | |uuo|ununoctium= | + | |rf|rutherfordium= |
| − | |#default=[[Category:Pages with incorrect nuclide templates use]]{{FormattingError|unknown element {{{1}}}.|nocategory={{{nocategory|}}}}} | + | |db|dubnium= |
| + | |sg|seaborgium= | ||
| + | |bh|bohrium= | ||
| + | |hs|hassium= | ||
| + | |mt|meitnerium= | ||
| + | |ds|darmstadtium= | ||
| + | |rg|roentgenium= | ||
| + | |uub|ununbium= | ||
| + | |uut|ununtrium= | ||
| + | |uuq|ununquadium= | ||
| + | |uup|ununpentium= | ||
| + | |uuh|ununhexium= | ||
| + | |uus|ununseptium= | ||
| + | |uuo|ununoctium= | ||
| + | |#default=[[Category:Pages with incorrect nuclide templates use]]<!-- | ||
| + | -->{{FormattingError | ||
| + | |unknown element {{{1}}}. | ||
| + | |nocategory={{{nocategory|}}} | ||
| + | }} | ||
}}</includeonly> | }}</includeonly> | ||
Revision as of 14:59, 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 "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 "The generic element 'X' does not have a page to link to.
"
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 "Aluminum is not a valid way to spell {
"
{{CheckElement|Sulphur}}will return "Sulphur is not a valid way to spell {
"
{{CheckElement|Cesium}}will return "Cesium is not a valid way to spell {
"
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. |