Difference between revisions of "Template:LinkForElement"

From blackwiki
Jump to navigation Jump to search
imported>Double sharp
imported>SkyLined
(fix error caused by accidental <noinclude>x</noinclude>)
 
(5 intermediate revisions by 5 users not shown)
Line 8: Line 8:
 
|{{#switch:{{lc:{{{1}}}}}
 
|{{#switch:{{lc:{{{1}}}}}
 
|
 
|
|aluminum={{FormattingError|Aluminum is not a [[Wikipedia:WikiProject_Chemicals/Style_guidelines#Element_names|valid]] way to spell aluminium.|nocategory={{{nocategory|}}}}}
+
|aluminum={{FormattingError|nocategory={{{nocategory|}}}|Aluminum is not a [[Wikipedia:WikiProject_Chemicals/Style_guidelines#Element_names|valid]] way to spell aluminium.}}
|sulphur={{FormattingError|Sulphur is not a [[Wikipedia:WikiProject_Chemicals/Style_guidelines#Element_names|valid]] way to spell sulfur.|nocategory={{{nocategory|}}}}}
+
|sulphur={{FormattingError|nocategory={{{nocategory|}}}|Sulphur is not a [[Wikipedia:WikiProject_Chemicals/Style_guidelines#Element_names|valid]] way to spell sulfur.}}
|cesium={{FormattingError|Cesium is not a [[Wikipedia:WikiProject_Chemicals/Style_guidelines#Element_names|valid]] way to spell caesium.|nocategory={{{nocategory|}}}}}
+
|cesium={{FormattingError|nocategory={{{nocategory|}}}|Cesium is not a [[Wikipedia:WikiProject_Chemicals/Style_guidelines#Element_names|valid]] way to spell caesium.}}
 
|
 
|
|x|element={{FormattingError|The generic element '{{{1}}}' does not have a page to link to.}}
+
|x|element={{FormattingError|nocategory={{{nocategory|}}}|The generic element '{{{1}}}' does not have a page to link to.}}
 
|mu|muonium=muonium
 
|mu|muonium=muonium
 
|ps|positronium=positronium
 
|ps|positronium=positronium
Line 130: Line 130:
 
|rg|roentgenium=roentgenium
 
|rg|roentgenium=roentgenium
 
|cn|copernicium=copernicium
 
|cn|copernicium=copernicium
|uut|ununtrium=ununtrium
+
|nh|nihonium=nihonium
 
|fl|flerovium=flerovium
 
|fl|flerovium=flerovium
|uup|ununpentium=ununpentium
+
|mc|moscovium=moscovium
 
|lv|livermorium=livermorium
 
|lv|livermorium=livermorium
|uus|ununseptium=ununseptium
+
|ts|tennessine=tennessine
|uuo|ununoctium=ununoctium
+
|og|oganesson=oganesson
 +
<!-- 119 and above: -->
 
|uue|ununennium=ununennium
 
|uue|ununennium=ununennium
 
|ubn|unbinilium=unbinilium
 
|ubn|unbinilium=unbinilium
Line 145: Line 146:
 
|ubh|unbihexium=unbihexium
 
|ubh|unbihexium=unbihexium
 
|ubs|unbiseptium=unbiseptium
 
|ubs|unbiseptium=unbiseptium
|#default = [[Category:Pages with incorrect nuclide templates use]]Error in [[Template:LinkForElement]]: unknown element {{{1}}}.
+
|#default = {{#if:{{{nocategory|}}}||[[Category:Pages with incorrect nuclide templates use]]}}{{FormattingError|nocategory={{{nocategory|}}}|Error in [[Template:LinkForElement]]: unknown element {{{1}}}{{main other|1=[[Category:Chemical element unknown]]}}.}}
 
}}}}</includeonly>
 
}}}}</includeonly>

Latest revision as of 13:23, 15 February 2018

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

Template that returns the Wikipedia page for an element given its name or the Wikipedia page for an isotope given the element's name and its mass number.

Example usage

  • {{LinkForElement|Mercury}} will return "mercury (element)"
  • {{LinkForElement|Uranium|238}} will return "uranium-238"

When using a common name for an element that goes against the Wikipedia style guide for element names, a warning message will inform the editor about this. There are currently three such names:

  • {{LinkForElement|Aluminum}} will return "Aluminum is not a valid way to spell aluminium."
  • {{LinkForElement|Sulphur}} will return "Sulphur is not a valid way to spell sulfur."
  • {{LinkForElement|Cesium}} will return "Cesium is not a valid way to spell caesium."

Because the output of this script is expected to get used in a link and any error message this script outputs will also contain links, the error message will look corrupt. It is recommended that you use {{CheckElement}} to check that no error message will be output before using this template. If {{CheckElement}} returns an error message, you should output that error message instead.

See also

Template:Periodic table templates