Difference between revisions of "Template:CheckElement"

From blackwiki
Jump to navigation Jump to search
(Add Unbiseptium)
imported>Wbm1058
(Undid revision 848730348 by Wbm1058 (talk) never mind. that just replaces the error with errors in Template:ProtonsForElement and in Template:SymbolForElement. I'll just edit the archives.)
 
(17 intermediate revisions by 12 users not shown)
Line 1: Line 1:
 
<includeonly>{{#switch:{{lc:{{{1}}} }}
 
<includeonly>{{#switch:{{lc:{{{1}}} }}
 
   |x|element={{#ifeq:{{lc:{{{link|}}} }} |yes
 
   |x|element={{#ifeq:{{lc:{{{link|}}} }} |yes
     |{{#if:{{{nocategory|}}} | |[[Category:Pages with incorrect nuclide templates use]]}}{{FormattingError
+
     |{{#if:{{{nocategory|}}} | |[[Category:Pages with incorrect nuclide templates use]]}}{{Formatting error
 
       |The generic element '{{{1}}}' does not have a page to link to.|nocategory={{{nocategory|}}} }}<!--
 
       |The generic element '{{{1}}}' does not have a page to link to.|nocategory={{{nocategory|}}} }}<!--
 
   -->}}
 
   -->}}
Line 7: Line 7:
 
   |sulphur
 
   |sulphur
 
   |cesium={{#if:{{{nocategory|}}} | |[[Category:Pages with incorrect nuclide templates use]]}}<!--
 
   |cesium={{#if:{{{nocategory|}}} | |[[Category:Pages with incorrect nuclide templates use]]}}<!--
     -->{{FormattingError
+
     -->{{Formatting error
 
     |{{{1}}} is not a [[Wikipedia:WikiProject Chemicals/Style guidelines#Element names|valid]]<!--
 
     |{{{1}}} is not a [[Wikipedia:WikiProject Chemicals/Style guidelines#Element names|valid]]<!--
  
Line 44: Line 44:
 
   |v|vanadium=
 
   |v|vanadium=
 
   |cr|chromium=
 
   |cr|chromium=
   |mr|manganese=
+
   |mn|manganese=
 
   |fe|iron=
 
   |fe|iron=
 
   |co|cobalt=
 
   |co|cobalt=
Line 132: Line 132:
 
   |rg|roentgenium=
 
   |rg|roentgenium=
 
   |cn|copernicium=
 
   |cn|copernicium=
   |uut|ununtrium=
+
   |nh|nihonium=
 
   |fl|flerovium=
 
   |fl|flerovium=
   |uup|ununpentium=
+
   |mc|moscovium=
 
   |lv|livermorium=
 
   |lv|livermorium=
   |uus|ununseptium=
+
   |ts|tennessine=
   |uuo|ununoctium=
+
   |og|oganesson=
 +
<!-- 119 and higher: -->
 
   |uue|ununennium=
 
   |uue|ununennium=
 +
  |ubn|unbinilium=
 +
  |ubu|unbiunium=
 +
  |ubb|unbibium=
 +
  |ubt|unbitrium=
 +
  |ubq|unbiquadium=
 +
  |ubp|unbipentium=
 
   |ubh|unbihexium=
 
   |ubh|unbihexium=
 
   |ubs|unbiseptium=
 
   |ubs|unbiseptium=
   |#default={{#if:{{{nocategory|}}} | |[[Category:Pages with incorrect nuclide templates use]]}}<!--
+
   |#default = {{#if:{{{nocategory|}}}||[[Category:Pages with incorrect nuclide templates use]]}}{{Formatting error|nocategory={{{nocategory|}}}|The element {{{1}}} does not exist{{main other|1=[[Category:Chemical element unknown]]}}.}}
 
+
}}</includeonly><noinclude>{{documentation}}</noinclude>
    -->{{FormattingError
 
    |unknown element {{{1}}}.|nocategory={{{nocategory|}}} }}<!--
 
-->}}</includeonly><noinclude>
 
{{documentation}}
 
<!--
 
PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS
 
Normally, the code for the template is included, but this template is too complex to do that.
 
--></noinclude>
 

Latest revision as of 22:39, 3 July 2018

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

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 "The element Blablabla does not exist."

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 aluminium."
  • {{CheckElement|Sulphur}} will return "Sulphur is not a valid way to spell sulfur."
  • {{CheckElement|Cesium}} will return "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