Module:LBFDigit

Documentation for this module may be created at Module:LBFDigit/doc

local getArgs = require('Module:Arguments').getArgs;
local defArgs = require('Module:Arguments').defaultArgs;
local lbfdigit = {};

function lbfdigit.digit910( frame )
  local args = defArgs(getArgs(frame), 1, "");
  local arg = args[1];
  local text = ""

  local L = {};
  local desc = {
SC = "straight-chain",
BC = "branched-chain",
HP = "hydroperoxy",
HO = "hydroxy and alcoholic",
OX = "oxo",
EO = "epoxy",
MO = "methoxy",
CA = "carboxylic",
OP = "12-oxo-phytodienoic",
JA = "jasmonic related",
PG = "prostaglandin",
LT = "leukotriene",
TX = "thromboxane",
LX = "lipoxin",
HX = "hepoxilin",
CV = "clavulone",
AM = "amide",
SF = "sulfur containing",
PH = "phosphate",
XX = "others"
};
  local c;
  for id in arg:gmatch("%S+") do
    c = string.sub(id,4,5);
    id = string.sub(id,9,10);
    if (L[id] == nil) then L[id] = id end
  end
  for k,v in pairs(L) do
    if (desc[v] ~= nil)
      then p = desc[v] else p = "<span style=\"color:red\">?"..v.."?</span>"
    end
    text = text .. "&"..c .. "&" .. v .. "&" .. p;
  end

  return text
end

return lbfdigit