Difference between revisions of "Template:Format molecular formula/sandbox"

From blackwiki
Jump to navigation Jump to search
test>Crissov
test>Crissov
m (I don‘t know how to do it)
Line 21: Line 21:
 
     return '₉';  
 
     return '₉';  
 
   else if match == 'x' then
 
   else if match == 'x' then
     print 'ₓ';  
+
     return 'ₓ';  
 
   else     
 
   else     
     print '<sub style="font-variant-position:sub">' .. match .. '</sub>';  
+
     return '<sub style="font-variant-position:sub">' .. match .. '</sub>';  
 
   end
 
   end
 
end|plain=0}}<noinclude>
 
end|plain=0}}<noinclude>
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 11:15, 12 May 2016

This template requires an unnamed parameter (plain tet molecule representation to format as wikitet).

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

Usage

{{Format molecular formula|H2O}} gives the molecular formula for water (H2O).

Example arguments: H2O (above), CO2 (CO2), H6C2O (H6C2O), H2SO4 (H2SO4).

The Lua module just puts "<sub></sub>" tags in the wanted spots.

Similar templates

{{Format ion formula}}, for ion chemical formulas.