local R = {}
local ParcerList
ParcerList = function (S)
--mw.log("ParcerList=" .. S)
local n = string.find( S, "," )
if n == nil then
local SS
n = string.find( S, "%d" )
if n == nil then
return S
else
if n == 1 then
n = string.find( string.reverse(S), "%d" )
if n == 1 then
return "<span class=\"reflink plainlinks\">[http://www.chemnet.com/cas/supplier.cgi?exact=dict&terms=" .. S .. " " .. S .. "]</span>"
else
return ParcerList (string.sub (S, 1, string.len(S) - n + 1)) .. ParcerList(string.sub (S, 1-n))
end
else
return string.sub (S, 1, n-1) .. ParcerList(string.sub (S, n))
end
end
else
return ParcerList(string.sub (S, 1, n-1)) .. ", " .. ParcerList(string.sub (S, n+1))
end
end
function R.ParcerCAS(frame)
--mw.log("ParcerCAS")
--mw.log(frame)
return ParcerList (frame.args[1])
--return ParcerList (frame)
end
return R