Template:Index/name
From Metabolomics.JP
(Difference between revisions)
Line 10: | Line 10: | ||
{{#lua: | {{#lua: | ||
− | local common = {"methoxy", "hydroxy", "acid", "acetyl", "alpha", "amino", "alpha", "acetyloxy" | + | local common = {"methoxy", "hydroxy", "acid", "acetyl", "alpha", "aalpha", "amino", "alpha", "acetyloxy" }; |
local key = stdin:match("%w+"); | local key = stdin:match("%w+"); | ||
local H = {}; | local H = {}; | ||
+ | local I = {}; | ||
for id, name in stdin:gmatch("&&(%w+).Common Name=&&(%S+)") do | for id, name in stdin:gmatch("&&(%w+).Common Name=&&(%S+)") do | ||
name = string.lower(name); | name = string.lower(name); | ||
Line 19: | Line 20: | ||
(string.sub(term,0,1) == key)) then | (string.sub(term,0,1) == key)) then | ||
if (H[term] == nil) then | if (H[term] == nil) then | ||
− | H[term] = id; | + | H[term] = id; table.insert(I, term); |
else | else | ||
H[term] = H[term] .. ";" .. id; | H[term] = H[term] .. ";" .. id; | ||
Line 26: | Line 27: | ||
end | end | ||
end | end | ||
− | table.sort( | + | table.sort(I); |
local ret = ""; | local ret = ""; | ||
− | for k | + | for k in I do |
ret = ret .. "* " .. k; | ret = ret .. "* " .. k; | ||
− | for id in string.gmatch( | + | for id in string.gmatch(H[k],"%w+") do |
ret = ret .. " [[" .. id .."]] "; | ret = ret .. " [[" .. id .."]] "; | ||
end | end |
Revision as of 20:00, 1 October 2008
名前のインデクス {{{1}}} 値(文字列) {{{2}}} ページタイトル (FL/LB/..) Last updated: 20081001200059
[[Index:{{{2}}}]] |
./lua: /tmp/mw_ex_lua_0GzMW4:20: attempt to call a table value