Difference between pages "Template:Format molecular formula" and "Template:Format molecular formula/sandbox"

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
m (8 revisions imported)
 
m (12 revisions imported)
 
Line 1: Line 1:
{{{{{|safesubst:}}}#invoke:String|replace|{{{1|'''This template requires an unnamed parameter (plain text molecule representation to format as wikitext).'''}}}|(%u%l?)([%dxy]+)|%1<sub>%2</sub>|plain=0}}<noinclude>{{Documentation}}</noinclude>
+
{{{{{|safesubst:}}}#invoke:String|replace|{{{1|'''This template requires an unnamed parameter (plain text molecule representation to format as wikitext).'''}}}|[0-9x]|function (match)  
 +
  if match == '0' then
 +
    return '₀';
 +
  else if match == '1' then
 +
    return '₁';
 +
  else if match == '2' then
 +
    return '₂';
 +
  else if match == '3' then
 +
    return '₃';
 +
  else if match == '4' then
 +
    return '₄';
 +
  else if match == '5' then
 +
    return '₅';
 +
  else if match == '6' then
 +
    return '₆';
 +
  else if match == '7' then
 +
    return '₇';
 +
  else if match == '8' then
 +
    return '₈';
 +
  else if match == '9' then
 +
    return '₉';
 +
  else if match == 'x' then
 +
    return 'ₓ';
 +
  else   
 +
    return '<sub style="font-variant-position:sub">' .. match .. '</sub>';
 +
  end
 +
end|plain=0}}<noinclude>
 +
{{Documentation}}
 +
</noinclude>