Template:Index/formula

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
Line 4: Line 4:
 
|-
 
|-
 
|align=left|
 
|align=left|
{{#repeat:
+
{{#repeat:Index/persist|6|
{{Index/persist|formula|{{{1}}}|{{{2}}}|Index/formula|{{{3}}}|}}
+
  {{#lua:
 +
  local id;
 +
  local output = "";
 +
  for id in stdin:gmatch("&&(%w+)") do
 +
    output = output.."%formula%{{{1}}}%{{#expr:{{{2}}}-1}}%Index/formula%"..id.."%{{{3}}}";
 +
  end
 +
  print(output);|{{{3}}} }}
 +
|%}}
 +
|align=center| [[Index:{{#substring:{{{4}}}|0|2}}|Back to Index]]
 
|align=right|
 
|align=right|
{{Index/persist|formula|{{{1}}}|{{{2}}}|Index/formula|{{{3}}}|}}
+
{{#repeat:Index/persist|5|
 +
  {{#lua:
 +
  local id;
 +
  local output = "";
 +
  for id in stdin:gmatch("&&(%w+)") do
 +
    output = output.."%formula%{{{1}}}%{{#expr:{{{2}}}+1}}%Index/formula%"..id.."%{{{3}}}";
 +
  end
 +
  print(output);|{{{3}}} }}
 +
|%}}
 
|}
 
|}
  
Line 14: Line 30:
 
{{#repeat:IndexTable|1|
 
{{#repeat:IndexTable|1|
 
{{#lua:
 
{{#lua:
   local id, atom, num, pat;
+
   local id, formula;
 +
  local pat = "{{{1|C}}}".."{{{2|20}}}[$A-Z]";
 
   local hash = {};
 
   local hash = {};
 
   local idx = {};
 
   local idx = {};
  local first = true;
 
 
   for id, formula in stdin:gmatch("&&(%w+)&&([%a%d]+)") do
 
   for id, formula in stdin:gmatch("&&(%w+)&&([%a%d]+)") do
     if (first) then ---:はじめの値は元素記号とその数
+
     if (formula.match(formula, pat) ~= null) then
      atom = id;
+
      if (hash[formula] == null)
    num = formula;
+
        then hash[formula] = id;
    first = false;
+
          table.insert(idx, formula);
    pat = id..formula.."[$A-Z]";
+
        else hash[formula] = hash[formula].."&&"..id;
    else
+
      if (formula.match(formula, pat) ~= null) then
+
        if (hash[formula] == null)
+
          then hash[formula] = id;
+
            table.insert(idx, formula);
+
          else hash[formula] = hash[formula].."&&"..id;
+
        end
+
 
       end
 
       end
 
     end
 
     end
Line 40: Line 49:
 
   end
 
   end
 
   print(output);
 
   print(output);
|&&{{{1|C}}}&&{{{2|20}}} {{#formula:{{{3|FL1C99}}}}}
+
|{{#formula:{{{3|FL1C99}}}}}
 
}}
 
}}
 
}}
 
}}
 
|}
 
|}

Revision as of 10:51, 2 May 2008

名前のインデクス {{{1}}} 原子 {{{2}}} 数 {{{3}}} ページタイトルと名前のリスト(&&区切り){{{4}}} ダミー Last updated: 20080502105101

[[Index:{{|Back to Index]]

Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox