Template:EditButton/CheckList

From Metabolomics.JP
< Template:EditButton(Difference between revisions)
Jump to: navigation, search
Line 5: Line 5:
 
{{#get:title}}    「species」や「効能」と言ったようなタイトル
 
{{#get:title}}    「species」や「効能」と言ったようなタイトル
 
-->{{#lua:
 
-->{{#lua:
--%% 前処理 %%--
+
--%% Preprocessing %%--
 
local list = {} -- データリスト
 
local list = {} -- データリスト
 
local i = 0;
 
local i = 0;
Line 12: Line 12:
 
   i = i + 1;
 
   i = i + 1;
 
end
 
end
--%% 表示処理 %%--
+
--%% Display Setting %%--
 
print('{{#form' .. 'tag:form|action="/wiki/{{#get:prevpage}}" method="post"|')
 
print('{{#form' .. 'tag:form|action="/wiki/{{#get:prevpage}}" method="post"|')
 
print('{{#form' .. 'tag:input|type="submit" value="update"}}<br>')
 
print('{{#form' .. 'tag:input|type="submit" value="update"}}<br>')
  
--%% できればここに目次を作成したい %%--
 
 
local head, body;
 
local head, body;
 
for i = 0, table.maxn(list) do
 
for i = 0, table.maxn(list) do
 
   head = string.match(list[i], "^([\*\#]+%s*)");
 
   head = string.match(list[i], "^([\*\#]+%s*)");
   --%% *,#で始まる行ならチェックボックスを、そうでないならそのまま表示 %%--
+
   --%% If *,# precedes a line, then place a checkbox, otherwise not. %%--
 
   if (head ~= nil) then
 
   if (head ~= nil) then
 
     body = string.sub(list[i],string.len(head)+1);
 
     body = string.sub(list[i],string.len(head)+1);
     --%% あらかじめセットしてあるデータをチェック - データは"、"区切り %%--
+
     --%% Check whether items are already selected. {{{1}}} is the separator %%--
     if (string.match("{{#get:initset}}", "" .. body .. "", 0) or
+
     if (string.match("{{#get:initset}}", "{{{1|&&}}}" .. body .. "{{{1|&&}}}", 0) or
         string.match("{{#get:initset}}", "^" .. body .. "", 0) or
+
         string.match("{{#get:initset}}", "^" .. body .. "{{{1|&&}}}", 0) or
         string.match("{{#get:initset}}", "" .. body .. "$", 0) ) then
+
         string.match("{{#get:initset}}", "{{{1|&&}}}" .. body .. "$", 0) ) then
 
       checked = ' checked="yes"'  
 
       checked = ' checked="yes"'  
 
     else
 
     else

Revision as of 09:39, 10 April 2009


{{ }}

Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox