Template:LBGA/GroupTable: Difference between revisions

No edit summary
(Replaced content with "{{#replace: {{#invoke:LBGA|GroupTable| {{#SearchLineReg:SugarGroup=~PolarGroup=||{{{1}}}_%}} }} |&|{{#bar:}}}}")
Tag: Replaced
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{#replace:
{{#replace:
{{#lua:
{{#invoke:LBGA|GroupTable|
local Tp = {}
local Ts = {}
local S0 = {}; S1 = {}; S2= {}; S3 = {}
 
function printTable(T, title)
  print('==' .. title .. '==\n{& class="wikitable sortable"\n! ID && Polar group<br/><small>Gro: glycerol </small> && Sugar group<br/><small>Glc: glucose Gul: gulose</small>')
  for k,v in ipairs(T) do
    s = "\n&-\n& [[" .. v .. "]] && "
    if (Tp[v] ~= nil) then s = s .. Tp[v] end
    s = s .. " && "
    if (Ts[v] ~= nil) then s = s .. Ts[v] end
    print(s)
  end
  print("\n&}")
end
 
for id, group, seq in stdin:gmatch("&&([^\n]+){{#bar:}}([%w]+)Group=([^\n]+)") do
  if (string.match(group,"Polar")) then Tp[id] = seq end
  if (string.match(group,"Sugar")) then Ts[id] = seq end
  s = string.sub(id,7,7)
  if (s == "0") then table.insert(S0, id)
  elseif (s == "1") then table.insert(S1, id)
  elseif (s == "2") then table.insert(S2, id)
  else table.insert(S3, id) end
end
 
printTable(S0, "No Sugar")
printTable(S1, "One Sugar <small>including inositol</small>")
printTable(S2, "Two Sugars <small>including inositol</small>")
printTable(S3, "Three or more <small>including inositol</small>")
|
{{#SearchLineReg:SugarGroup=~PolarGroup=||{{{1}}}_%}}
{{#SearchLineReg:SugarGroup=~PolarGroup=||{{{1}}}_%}}
}}
}}
|&|{{#bar:}}}}
|&|{{#bar:}}}}

Latest revision as of 00:09, 30 January 2023

No Sugar

ID Polar group
Gro: glycerol
Sugar group
Glc: glucose Gul: gulose

One Sugar including inositol

ID Polar group
Gro: glycerol
Sugar group
Glc: glucose Gul: gulose

Two Sugars including inositol

ID Polar group
Gro: glycerol
Sugar group
Glc: glucose Gul: gulose

Three or more including inositol

ID Polar group
Gro: glycerol
Sugar group
Glc: glucose Gul: gulose