Sandbox92

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
−
{{Volatile:Search|{{#lua:
+
<!--- {{{1}}} ID numbers to search
−
--%% 34桁目 %%--
+
      {{{2}}} Result size per page
−
local searchid, id
+
      {{{3}}} Page number (starting from 0)--->
−
searchid = "FL"
+
{{#def:RESULT|{{#repeat:SearchTitle|1|{{{1}}}}}}}
−
if(string.len("{{#get:34[]}}") == 0) then
+
<!--{{#def:SIZE|{{#if:{{#var:RESULT}}|{{#expr:1+{{#count:{{#var:RESULT}}|&#160;}}}}|0}}}}-->
−
  searchid = searchid .. ".."
+
{{#def:SIZE|{{#if:{{#var:RESULT}}|{{#expr:{{#count:{{#var:RESULT}}}}}}|0}}}}
−
else
+
−
  local id3s, id4s
+
−
  id3s = ""
+
−
  id4s = ""
+
−
  for id in string.gmatch("{{#get:34[]}}", "%S+") do
+
−
    id3s = id3s .. string.sub(id, 1, 1)
+
−
    id4s = id4s .. string.sub(id, 2, 2)
+
−
  end
+
−
  searchid = searchid .. "[" .. id3s .. "][" .. id4s .. "]"
+
−
end
+
  
−
--%% 56桁目 %%--
+
==Search Result ({{#var:SIZE}} Hits)==
−
local id5s, id6s
+
View (previous {{#ifexpr: {{{3}}} <= 0 | {{{2}}} | [[{{FULLPAGENAME}}|{{{1}}}|{{{2}}}|{{#expr:{{{3}}}-1}}|{{{2}}}]]}}) (next {{#ifexpr: {{{3}}}*{{{2}}} > {{#var:SIZE}} | {{{2}}} | [[{{FULLPAGENAME}}|{{{1}}}|{{{2}}}|{{#expr:{{{3}}}+1}}|{{{2}}}]]}})
−
id5s = ""
+
([[{{FULLPAGENAME}}|{{{1}}}|20|{{{3}}}|20]] | [[{{FULLPAGENAME}}|{{{1}}}|50|{{{3}}}|50]] | [[{{FULLPAGENAME}}|{{{1}}}|100|{{{3}}}|100]] | [[{{FULLPAGENAME}}|{{{1}}}|250|{{{3}}}|250]] | [[{{FULLPAGENAME}}|{{{1}}}|500|{{{3}}}|500]])<br>
−
id6s = ""
+
{{#repeat: Search/Item|2|
−
if(string.len("{{#get:5[]}}") > 0) then
+
{{#lua:
−
  id5s = "[" .. string.gsub("{{#get:5[]}}", " ", "")
+
  local L = {};
−
end
+
   local start=tonumber({{{2}}})*tonumber({{{3}}});
−
if(string.len("{{#get:6[]}}") > 0) then
+
  local output ="";
−
  id6s = "[" .. string.gsub("{{#get:6[]}}", " ", "")
+
   for word in stdin:gmatch("%S+") do
−
end
+
     table.insert(L,word);
−
if(string.len("{{#get:56[]}}") == 0) then
+
−
   if(string.len(id5s) == 0) then
+
−
    id5s = ".";
+
−
   else
+
−
     id5s = id5s .. "]";
+
 
   end
 
   end
−
   if(string.len(id6s) == 0) then
+
   table.sort(L);
−
    id6s = ".";
+
  for idx=start+1, math.min(table.getn(L),start+tonumber({{{2}}})) do
−
  else
+
     output=output .. idx .. " " .. L[idx] .. " ";
−
     id6s = id6s .. "]";
+
 
   end
 
   end
−
else
+
   print(output);
−
   if(string.len(id5s) == 0) then
+
|{{#var:RESULT}}
−
    id5s = "[";
+
}}|&#160;}}
−
  end
+
−
  if(string.len(id6s) == 0) then
+
−
    id6s = "[";
+
−
  end
+
−
  for id in string.gmatch("{{#get:56[]}}", "%S+") do
+
−
    id5s = id5s .. string.sub(id, 1, 1)
+
−
    id6s = id6s .. string.sub(id, 2, 2)
+
−
  end
+
−
  id5s = id5s .. "]";
+
−
  id6s = id6s .. "]";
+
−
end
+
−
searchid = searchid .. id5s .. id6s
+
−
 
+
−
--%% 7桁目 %%--
+
−
if(string.len("{{#get:7[]}}") == 0) then
+
−
  searchid = searchid .. "."
+
−
else
+
−
  searchid = searchid .. "[" .. string.gsub("{{#get:7[]}}", " ", "") .. "]"
+
−
end
+
−
 
+
−
--%% 8桁目 %%--
+
−
if(string.len("{{#get:8[]}}") == 0) then
+
−
  searchid = searchid .. "."
+
−
else
+
−
  searchid = searchid .. "[" .. string.gsub("{{#get:8[]}}", " ", "") .. "]"
+
−
end
+
−
 
+
−
--%% 9桁目 %%--
+
−
if(string.len("{{#get:9[]}}") == 0) then
+
−
  searchid = searchid .. "."
+
−
else
+
−
  searchid = searchid .. "[" .. string.gsub("{{#get:9[]}}", " ", "") .. "]"
+
−
end
+
−
 
+
−
print(searchid .. "...")
+
−
|}}|50|0}}
+

Latest revision as of 22:44, 25 January 2009



[edit] Search Result (0 Hits)

View (previous Expression error: Unrecognised punctuation character "{".) (next Expression error: Unrecognised punctuation character "{".) ({{{1}}}|20|{{{3}}}|20 | {{{1}}}|50|{{{3}}}|50 | {{{1}}}|100|{{{3}}}|100 | {{{1}}}|250|{{{3}}}|250 | {{{1}}}|500|{{{3}}}|500)
./lua:.   /tmp/mw_ex_lua_cGj6Lv:2:  
attempt.   to  
perform.   arithmetic  
on.   a  
nil.   value  

Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox