Welcome to EverybodyWiki 😃 ! Nuvola apps kgpg.png Log in or ➕👤 create an account to improve, watchlist or create an article like a 🏭 company page or a 👨👩 bio (yours ?)...

پودمان:Chem2

از EverybodyWiki Bios & Wiki
پرش به:ناوبری، جستجو
صفحه الگو:Ombox/styles.css محتوایی ندارد.

Module:chem2 - پودمان:MolarMass (this modules structure is based on Module:MolarMass)

Usage[ویرایش]

Exported function :

  • chem(frame) – returns the chemical formula

Uses :

  • formula – args[1] = formula.
  • parameter: link= link to article auto=yes auto link to elements

Documentation[ویرایش]

Symbol Gives Example Output
\s {{Chem2|CH3\sCH3}} CH
3
–CH
3
\d = {{Chem2|CH2\dCH2}} CH
2
=CH
2
\t {{Chem2|HC\tCH}} HC≡CH
\q {{Chem2|[Cl4Re\qReCl4](2−)|}} [Cl
4
Re≣ReCl
4
]2–
\- -
\\ \
\' '
(')
{{Chem2|R'R\''CH2}} R'R''CH
2
\h η
\h{1} η1
\m{1} μ1
-> {{Chem2|2H2 + O2 -> 2H2O}} 2H
2
+ O
2
→ 2H
2
O
<->
*  · {{Chem2|CoCl2*6H2O}} CoCl
2
 · 6H2O
_{} {{Chem2|CH4_{(g)}|}} CH
4

(g)
^{} {{Chem2|^{13}CH4}} 13
CH
4

If input ends with a }, the input should be added an ending |; otherwise Mediawiki miss the ending } ("translate" to English, please)

Formulas (without charge) are just written. Eg.:

  • {{Chem2|CH3(CH2)5CH3}} gives CH
    3
    (CH
    2
    )
    5
    CH
    3
  • {{Chem2|Fe3S2(CO)9}} gives Fe
    3
    S
    2
    (CO)
    9
  • {{Chem2|C_{''n''}H_{2''n'' + 2}|}} gives C
    n
    H
    2n + 2

Charges are written inside parenthesis, otherwise its treated as +1 og -1. Eg.:

  • {{Chem2|Na+}} gives Na+
  • {{Chem2|O2-}} gives O
    2
    but can be written as {{Chem2|O2(-)}} too.
  • {{Chem2|SO4(2-)}} gives SO2–
    4
  • {{Chem2|S19(2+)}} gives S2+
    19

Chemical equations can be written too. E.g.:

  • {{Chem2|2 S + 3 O2 + 2 H2O -> 2 H2SO4}} gives 2 S + 3 O
    2
    + 2 H
    2
    O → 2 H
    2
    SO
    4
  • {{Chem2|2S + 3O2 + 2H2O -> 2H2SO4}} gives 2S + 3O
    2
    + 2H
    2
    O → 2H
    2
    SO
    4

The arrows can be written as -> or just →. All characters (and unicode markup) are valid input except \, = (Mediawiki use it), _ and - (endash etc.)

  • {{Chem2|2 H2_{(g)} + O2_{(g)} -> 2H2O_{(g)}|}} gives 2 H
    2

    (g)
    + O
    2

    (g)
    → 2H
    2
    O
    (g)
  • {{Chem2|NH2RCHCO2H <-> NH3+RCHCO2-}} gives NH
    2
    RCHCO
    2
    H ⇌ NH+
    3
    RCHCO
    2

پیوندپوشی and mu:

  • {{Chem2|W(CO)3(PiPr3)2(\h{2}\-H2)}} gives W(CO)
    3
    (PiPr
    3
    )
    2
    2–-H
    2
    )
  • {{Chem2|auto=yes|W(CO)3(PiPr3)2(\h{2}\-H2)}} gives W(CO)
    3
    (PiPr
    3
    )
    2
    2–-H
    2
    )

Links: Use link=<wiki page> eg.:

  • {{Chem2|link=Iron(III) chloride|FeCl3}} gives FeCl
    3

Auto links: Automatic link elements: Use auto=something (eg. yes):

  • {{Chem2|auto=yes|CH3CH2CH3CBrFCIClCH3}} gives CH
    3
    CH
    2
    CH
    3
    CBrFCIClCH
    3

Examples[ویرایش]

  • {{Chem2|[Cl4Re\qReCl4](2−)|}} is [Cl
    4
    Re≣ReCl
    4
    ]2–
  • {{Chem2|[Cl4Re\qReCl4](2-)|}} is [Cl
    4
    Re≣ReCl
    4
    ]2–
  • {{Chem2|NH2RCHCO2H <-> NH3+RCHCO2−}} gives NH
    2
    RCHCO
    2
    H ⇌ NH+
    3
    RCHCO
    2
  • "\\hallo" is \hallo
  • H3CC\tCH <-> H2C\dC\dCH2 is H
    3
    CC≡CH ⇌ H
    2
    C=C=CH
    2
  • "4 NH3 + 5 O2 -> 4 NO + 6 H2O" is 4 NH
    3
    + 5 O
    2
    → 4 NO + 6 H
    2
    O
  • "H2O & #8594; H2O" is H
    2
    O → H
    2
    O (No space in unicode input)
  • "H2O_{(l)} -> H2O_{(g)}" is H
    2
    O
    (l)
    → H
    2
    O
    (g)


  • "4 NH3 + 5 O2 → 4 NO + 6 H2O" is 4 NH
    3
    + 5 O
    2
    → 4 NO + 6 H
    2
    O
  • " 4 NH3 + 5 O2 → 4 NO + 6 H2O" is 4 NH
    3
    + 5 O
    2
    → 4 NO + 6 H
    2
    O
  • " 4NH3 + 5O2 → 4NO + 6H2O" is 4NH
    3
    + 5O
    2
    → 4NO + 6H
    2
    O
  • " 2Mn2(+)" is 2Mn+
    2
  • " 2Mn2(+) + 3H2O" is 2Mn+
    2
    + 3H
    2
    O
  • Mn– is Mn
  • Mn2(2-) is Mn2–
    2
  • Mn2☃+ is Mn
    2
    +
    , Mn2(2–) is Mn2–
    2
    , Mn2(2☃–) is Mn
    2
    (
    2

    )
  • Mn2(+) is Mn+
    2
  • Mn2+ is Mn+
    2
  • Mn2(-) is Mn
    2
  • Mn2- is Mn
    2





  • {{Chem2|C_{''n''}H_{2''n'' + 2}|}} gives C
    n
    H
    2n + 2
  • {{Chem2|C_{abc}|}} gives C
    abc
  • (chem gives C
    n
    H
    2n + 2
    )
  • {{Chem2|CoCl2*1.5H2O}} gives CoCl
    2
     · 1.5H2O
  • Mn22– is Mn
    22
  • Cu2C2*H2O is Cu
    2
    C
    2
     · H2O


Special
  • {{Chem2|[Me2Al(\m{2}Me)]2}} gives [Me
    2
    Al(μ2–Me)]
    2
  • {{Chem2|auto=yes|\i{13}CO2}} gives CO
    2
  • {{Chem2|\h{5}(C5H5)2TiCl2}} gives η5–(C
    5
    H
    5
    )
    2
    TiCl
    2
  • {{Chem2|\h{5}\s(C5H5)}} gives η5––(C
    5
    H
    5
    )
  • {{Chem2|CH2\dCH2\sCH2\sC\tCH\qMn}} is CH
    2
    =CH
    2
    –CH
    2
    –C≡CH≣Mn


  • {{Chem2|RC(OR’)3}} gives RC(OR’)
    3
  • {{Chem2|C\\C}} gives C\C
  • {{Chem2|C2*NH3}} gives C
    2
     · NH
    3
  • {{Chem2|C2*2NH3}} gives C
    2
     · 2NH
    3
  • {{Chem2|C1.2H3.5}} gives C
    1.2
    H
    3.5




  • {{Chem2|12|6|C}} is 12
  • {{Chem2|12|C}} is 12
  • {{Chem2|CH3\i{13}CH2CH3}} is CH
    3
    CH
    2
    CH
    3
  • {{Chem2|\{\{abc\}\}}} is AbC
  • C2(μ\-C) is C
    2
    (μ-C)


  • SO4(2-) is SO2–
    4
  • 2Mn2(2+) is 2Mn2+
    2
  • CH3-CH2-OH is CH
    3
    CH
    2
    OH
  • [ZnCl4]- is [ZnCl
    4
    ]
  • [ZnCl4](2-) is [ZnCl
    4
    ]2–
  • AUTO: ((H2O)5{CoCl2})2 is ((H
    2
    O)
    5
    {CoCl
    2
    })
    2
  • Si(OH)4 is Si(OH)
    4

--

  • AUTO: Cu2C2*H2O is Cu
    2
    C
    2
     · H2O
  • Cu2C2*2H2O is Cu
    2
    C
    2
     · 2H2O
  • CuSO*2H2O is CuSO · 2H2O
  • CuSO4*15H2O is CuSO
    4
     · 15H2O
  • CuSO4(H2O)5 is CuSO
    4
    (H
    2
    O)
    5
  • H+ + OH- → H2O is H+
    + OH
    → H
    2
    O
  • H → O is H → O
    • ZxPo4 is ZxPo
      4
          Unknown element
    • ((Na)Cl is ((Na)Cl''";     To many (
    • Si(OH))4 is Si(OH))
      4
      ''";     To many )
    • Si&آدم‌برفیSi is Si&آدم‌برفیSi
    • CH
      2
      =CH
      2

More[ویرایش]

  • {{Chem2|Cl2O6|link=dichlorine hexoxide}} is Cl
    2
    O
    6
  • [Fe(Phen)(Phen)3](2+) is [Fe(Phen)(Phen)
    3
    ]2+
  • AUTO: [Fe(Phen)(Phen)3](2+) is [[[Iron|Fe]](Phen)(Phen)
    3
    ]2+
  • {{Chem2|[C2O2](2+)}} is [C
    2
    O
    2
    ]2+
  • {{Chem2|link=Tomato|SI4}} is SI
    4
  • H2SO4+ is H
    2
    SO+
    4
  • Mn- is Mn
  • Mn22+ is Mn+
    22
    , Mn22- is Mn
    22
    ,
  • Mn(2+) is Mn2+
  • Mn2(+) is Mn+
    2
  • Mn(22-) is Mn22–
  • Mn3(22-) is Mn22–
    3
  • Mn(22+) is Mn22+
  • Mn2(22+) is Mn22+
    2
  • Mn2(2+) is Mn2+
    2
  • Mn22(2+) is Mn2+
    22

Chem vs chem2[ویرایش]

  • (CH
    3
    )
    2
    CO
  • (CH
    3
    )
    2
    CO
  • H+
    2
  • H+
    2



local getArgs = require('Module:Arguments').getArgs
local p = {} -- module's table

local am = {}  -- Elements with wiki links
am.H="[[Hydrogen|H]]";am.He="[[Helium|He]]";
am.Li="[[Lithium|Li]]";am.Be="[[Beryllium|Be]]";am.B="[[Boron|B]]";am.C="[[Carbon|C]]";am.N="[[Nitrogen|N]]";am.O="[[Oxygen|O]]";am.F="[[فلوئور|F]]";am.Ne="[[Neon|Ne]]";
am.Na="[[Sodium|Na]]";am.Mg="[[Magnesium|Mg]]";am.Al="[[Aluminium |Al]]";am.Si="[[Silicon|Si]]";am.P="[[Phosphorus|P]]";am.S="[[Sulfur |S]]";am.Cl="[[کلر|Cl]]";am.Ar="[[Argon|Ar]]";
am.K="[[Potassium|K]]";am.Ca="[[Calcium|Ca]]";am.Sc="[[Scandium|Sc]]";am.Ti="[[Titanium|Ti]]";am.V="[[Vanadium|V]]";am.Cr="[[Chromium|Cr]]";am.Mn="[[Manganese|Mn]]";am.Fe="[[Iron|Fe]]";am.Co="[[کبالت|Co]]";am.Ni="[[Nickel|Ni]]";am.Cu="[[مس|Cu]]";am.Zn="[[Zinc|Zn]]";am.Ga="[[Gallium|Ga]]";am.Ge="[[Germanium|Ge]]";am.As="[[Arsenic|As]]";am.Se="[[Selenium|Se]]";am.Br="[[برم|Br]]";am.Kr="[[Krypton|Kr]]";am.Rb="[[Rubidium|Rb]]";
am.Sr="[[Strontium|Sr]]";am.Y="[[Yttrium|Y]]";am.Zr="[[Zirconium|Zr]]";am.Nb="[[Niobium|Nb]]";am.Mo="[[Molybdenum|Mo]]";am.Tc="[[Technetium|Tc]]";am.Ru="[[Ruthenium|Ru]]";am.Rh="[[Rhodium|Rh]]";am.Pd="[[Palladium|Pd]]";am.Ag="[[Silver|Ag]]";am.Cd="[[Cadmium|Cd]]";am.In="[[Indium|In]]";am.Sn="[[Tin|Sn]]";am.Sb="[[Antimony|Sb]]";am.Te="[[Tellurium|Te]]";am.I="[[ید|I]]";am.Xe="[[Xenon|Xe]]";
am.Cs="[[Caesium|Cs]]";am.Ba="[[Barium|Ba]]";am.La="[[Lanthanum|La]]";am.Ce="[[Cerium|Ce]]";am.Pr="[[پرازئودیمیم|Pr]]";am.Nd="[[Neodymium|Nd]]";am.Pm="[[Promethium|Pm]]";am.Sm="[[Samarium|Sm]]";am.Eu="[[Europium|Eu]]";am.Gd="[[Gadolinium|Gd]]";am.Tb="[[Terbium|Tb]]";am.Dy="[[Dysprosium|Dy]]";am.Ho="[[Holmium|Ho]]";am.Er="[[Erbium|Er]]";am.Tm="[[Thulium|Tm]]";am.Yb="[[Ytterbium|Yb]]";am.Lu="[[Lutetium|Lu]]";am.Hf="[[Hafnium|Hf]]";am.Ta="[[Tantalum|Ta]]";am.W="[[Tungsten|W]]";am.Re="[[Rhenium|Re]]";am.Os="[[Osmium|Os]]";am.Ir="[[Iridium|Ir]]";am.Pt="[[Platinum|Pt]]";am.Au="[[Gold|Au]]";am.Hg="[[Mercury (element)|Hg]]";am.Tl="[[Thallium|Tl]]";am.Pb="[[Lead|Pb]]";am.Bi="[[Bismuth|Bi]]";am.Po="[[Polonium|Po]]";am.At="[[Astatine|At]]";am.Rn="[[Radon|Rn]]";
am.Fr="[[Francium|Fr]]";am.Ra="[[Radium|Ra]]";am.Ac="[[Actinium|Ac]]";am.Th="[[Thorium|Th]]";am.Pa="[[Protactinium|Pa]]";am.U="[[Uranium|U]]";am.Np="[[Neptunium|Np]]";am.Pu="[[Plutonium|Pu]]";am.Am="[[Americium|Am]]";am.Cm="[[Curium|Cm]]";am.Bk="[[Berkelium|Bk]]";am.Cf="[[Californium|Cf]]";am.Es="[[Einsteinium|Es]]";am.Fm="[[Fermium|Fm]]";am.Md="[[Mendelevium|Md]]";am.No="[[Nobelium|No]]";am.Lr="[[Lawrencium|Lr]]";am.Rf="[[Rutherfordium|Rf]]";am.Db="[[Dubnium|Db]]";am.Sg="[[Seaborgium|Sg]]";am.Bh="[[Bohrium|Bh]]";am.Hs="[[Hassium|Hs]]";am.Mt="[[Meitnerium|Mt]]";am.Ds="[[Darmstadtium|Ds]]";am.Rg="[[Roentgenium|Rg]]";am.Cp="[[Copernicium|Cp]]";am.Uut="[[Ununtrium|Uut]]";am.Uuq="[[Ununquadium|Uuq]]";am.Uup="[[Ununpentium|Uup]]";am.Uuh="[[Ununhexium|Uuh]]";am.Uus="[[Ununseptium|Uus]]";am.Uuo="[[Ununoctium|Uuo]]";

local T_ELEM = 0         -- token types
local T_NUM = 1          -- number
local T_OPEN = 2         -- open '('
local T_CLOSE = 3        -- close ')'
local T_PM_CHARGE = 4    -- + or –
local T_WATER = 6        -- .xH2O x number
local T_CRYSTAL = 9      -- .x
local T_CHARGE = 8       -- charge (x+), (x-)
local T_SUF_CHARGE = 10  -- suffix and charge e.g. 2+ from H2+
local T_SUF_CHARGE2 = 12 -- suffix and (charge) e.g. 2(2+) from He2(2+)
local T_SPECIAL = 14     -- starting with \ e.g. \d for double bond (=)
local T_SPECIAL2 = 16    -- starting with \y{x} e.g. \i{12} for isotope with mass number 12
local T_ARROW_R = 17     -- match: ->
local T_ARROW_EQ = 18    -- match: <->
local T_UNDERSCORE = 19  -- _{ ... }
local T_CARET = 20       -- ^{ ... }
local T_NOCHANGE = 30        -- Anything else like ☃

function su(up, down) -- like template:su
  if (down == "") then 
    return "<span style=\"display:inline-block; margin-bottom:-0.3em; vertical-align:0.8em; line-height:1.2em; font-size:70%; text-align:left;\">" .. up .. "<br /></span>";
  else
    return "<span style=\"display:inline-block; margin-bottom:-0.3em; vertical-align:-0.4em; line-height:1.2em; font-size:70%; text-align:left;\">" .. up .. "<br />" .. down .. "</span>";
  end
end

function DotIt()
  return '&nbsp;<span style="font-weight:bold;">&middot;</span>&#32;'
end


function item(f) -- (iterator) returns one token (type, value) at a time from the formula 'f'
   local i = 1
   local first = "true";

   return function ()
	local t, x = nil, nil

        if (first == "true" and f:match('^[0-9]', i)) then 
                 x = f:match('^[%d.]+', i); t = T_NOCHANGE; i = i + x:len();   -- matching coefficient (need a space first)

        elseif i <= f:len() then
                              x = f:match('^%s+[%d.]+', i); t = T_NOCHANGE;  -- matching coefficient (need a space first)
		if not x then x = f:match('^%s[+]', i); t = T_NOCHANGE; end       -- matching + (H2O + H2O)
		if not x then x = f:match('^%&%#[%w%d]+%;', i); t = T_NOCHANGE; end       -- &#...;
		if not x then x = f:match('^%<%-%>', i); t = T_ARROW_EQ; end       -- matching <->
		if not x then x = f:match('^%-%>', i); t = T_ARROW_R; end       -- matching ->
		if not x then x = f:match('^%u%l*', i); t = T_ELEM; end        -- matching symbols like Aaaaa
		if not x then x = f:match('^%d+[+-]', i); t = T_SUF_CHARGE; end        -- matching x+, x-
		if not x then x = f:match('^%d+%(%d*[+-]%)', i); t = T_SUF_CHARGE2; end        -- matching x(y+/-), x(+/-)
		if not x then x = f:match('^%(%d*[+-]%)', i); t = T_CHARGE; end        -- matching (x+) (xx+), (x-) (xx-)
		if not x then x = f:match('^[%d.]+', i); t = T_NUM; end        -- matching number
		if not x then x = f:match('^[(|{|%[]', i); t = T_OPEN; end     -- matching ({[
		if not x then x = f:match('^[)|}|%]]', i); t = T_CLOSE; end           -- matching )}]
		if not x then x = f:match('^[+-]', i); t = T_PM_CHARGE; end        -- matching + or -
		if not x then x = f:match('^%*[%d.]*H2O', i); t = T_WATER; end -- Crystal water
		if not x then x = f:match('^%*[%d.]*', i); t = T_CRYSTAL; end -- Crystal
		if not x then x = f:match('^[\\].{%d+}', i); t = T_SPECIAL2; end -- \y{x}
		if not x then x = f:match('^[\\].', i); t = T_SPECIAL; end -- \x
		if not x then x = f:match('^_{[^}]*}', i); t = T_UNDERSCORE; end -- _{...}
		if not x then x = f:match('^\^{[^}]*}', i); t = T_CARET; end -- ^{...}
		if not x then x = f:match('^.', i); t = T_NOCHANGE; end  --the rest - one by one
		if x then i = i + x:len(); else i = i + 999; error("Invalid character in formula!!!!!!! : "..f) end
	end
        first = "false"
	return t, x
	end
   end

function p._chem(args)
   
local f = args[1] or ''

   f = string.gsub(f, "–", "-")  -- replace – with -
   f = string.gsub(f, "−", "-")  -- replace – with -

   local sumO = 0
   local formula = ''
   local t, x

   local link = args['link'] or ""
   local auto = args['auto'] or ""

   if not (link == '') then formula = formula .. "[[" .. link .. "|"; end   -- wiki link start [[link|
 
   for t, x in item(f) do 
      if     t == T_ELEM then if (auto == '') then formula = formula .. x elseif am[x] then formula = formula .. am[x]; am[x] = x else formula = formula .. x end 
      elseif t == T_COEFFICIENT then formula = formula .. x
      elseif t == T_NUM   then formula = formula .. su("", x);
      elseif t == T_OPEN  then formula = formula .. x; sumO = sumO + 1;        -- ( {
      elseif t == T_CLOSE then formula = formula .. x; sumO = sumO -1;         -- ) }
      elseif t == T_PM_CHARGE    then formula = formula .. su(string.gsub(x, "-", "–"), "");
      elseif t == T_SUF_CHARGE then 
           formula = formula .. su(string.gsub(string.match(x, "[+-]"), "-", "–"), string.match(x, "%d+"), "");
      elseif t == T_SUF_CHARGE2 then 
          formula = formula .. su(string.sub(string.gsub(string.match(x, "%(%d*[+-]"), "-", "–"), 2, -1), string.match(x, "%d+"))

      elseif t == T_CHARGE then formula = formula .. "<sup>"; if string.match(x, "%d+") then formula = formula .. string.match(x, "%d+"); end formula = formula .. string.gsub(string.match(x, "[%+-]"), "-", "–") .. "</sup>";  -- can not concatenat a nil value from string.match(x, "%d+");

      elseif t == T_CRYSTAL then formula = formula .. DotIt() .. string.gsub( x, "*", ' ', 1 );

      elseif t == T_SPECIAL then
          parameter = string.sub(x, 2, 2) -- x fra \x  
          if       parameter == "s" then formula = formula .. "–"   -- single bond
            elseif parameter == "d" then formula = formula .. "="   -- double bond
            elseif parameter == "t" then formula = formula .. "≡"   -- tripple bond
            elseif parameter == "q" then formula = formula .. "≣"   -- Quadruple bond
            elseif parameter == "h" then formula = formula .. "η"   -- η, hapticity
            elseif parameter == "-" then formula = formula .. "-"   -- -
            elseif parameter == "\\" then formula = formula .. "\\"   -- \
            elseif parameter == "\'" then formula = formula .. "&#39;"   -- html-code for '
          end
      elseif t == T_SPECIAL2 then  -- \y{x}
         parameter = string.sub(x, 2, 2) -- y fra \y{x} 
          if parameter  == "h" then --[[Hapticity]]
             if (auto == '') then formula = formula .. "η<sup>" .. string.match(x, '%d+') .. "</sup>–" 
               else
             formula = formula .. "[[Hapticity|η<sup>" .. string.match(x, '%d+') .. "</sup>]]–" 
             end
--          elseif parameter == "i" then formula = formula .. su(string.match(x, '%d+'), "") -- [[isotope]]
          elseif parameter == "m" then formula = formula .. "μ<sup>" .. string.match(x, '%d+') .. "</sup>–"   -- mu ([[bridging ligand]])
          end
      elseif t == T_WATER then 
        if string.match(x, "^%*[%d.]") then 
            formula = formula .. DotIt() .. string.match(x, "%f[%.%d]%d*%.?%d*%f[^%.%d%]]") .. "H<sub>2</sub>O";
        else
          formula = formula .. DotIt() .. "H<sub>2</sub>O";
        end  
 
-- not (auto == nil or auto == '') then formula = formula .. DotIt .. 
-- "[[Water of crystallization|H<sub>2</sub>O]]";
--            else
--              formula = formula .. 
-- DotIt .. "H<sub>2</sub>O";
---- xxx brug af sub til tal
--            end

      elseif t == T_UNDERSCORE  then formula = formula .. su("", string.sub(x,3,-2)) -- x contains _{string}
      elseif t == T_CARET then formula = formula .. su(string.sub(x,3,-2), "") -- x contains ^{string}

      elseif t == T_ARROW_R then formula = formula .. " → "
      elseif t == T_ARROW_EQ then formula = formula .. " ⇌ "

      elseif t == T_NOCHANGE  then formula = formula .. x;  -- resten, som ikke blev fanget af diverse regular expresions
     
      else error('unreachable - ???') end -- in fact, unreachable

end

   if      sumO > 0 then formula = formula .. "'<span style=\"display:none;font-size:100%\" class=\"error citation-comment\">   Too many (</span>'\";"
    elseif sumO < 0 then formula = formula .. "'<span style=\"display:none;font-size:100%\" class=\"error citation-comment\">   Too many )</span>'\";"
   end

   if not (link == nil or link == '') then formula = formula .. "]]"; end   -- wikilink closing ]]

   return formula
end

function p.chem(frame)
	local args = getArgs(frame)
	return p._chem(args)
end

return p
This module "Chem2" is from Wikipedia if otherwise notified