Template:Index/name
From Metabolomics.JP
(Difference between revisions)
Line 1: | Line 1: | ||
<noinclude>名前のインデクス {{{1}}} 最小値(デフォルトaa) {{{2}}} 最大値(デフォルトab) {{{3}}} ページタイトル {{{4}}}ダミー</noinclude> | <noinclude>名前のインデクス {{{1}}} 最小値(デフォルトaa) {{{2}}} 最大値(デフォルトab) {{{3}}} ページタイトル {{{4}}}ダミー</noinclude> | ||
Last updated: {{REVISIONTIMESTAMP}} | Last updated: {{REVISIONTIMESTAMP}} | ||
+ | |||
+ | <!---- | ||
{| width=100% | {| width=100% | ||
|- | |- | ||
Line 11: | Line 13: | ||
else print(string.sub(id,0,1)..string.char(string.byte(id,2)-1)); | else print(string.sub(id,0,1)..string.char(string.byte(id,2)-1)); | ||
end | end | ||
− | end | + | end | {{{1|aa}}} }} |
− | | {{{1|aa}}} }} | + | |
|{{#lua: | |{{#lua: | ||
local id = stdin:match("%S+"); | local id = stdin:match("%S+"); | ||
− | if (id == " | + | if (id == "zz") then |
− | print(" | + | print("zz"); |
else if (string.byte(id,2) == 'a') then | else if (string.byte(id,2) == 'a') then | ||
print(string.char(string.byte(id,1)-1).."z"); | print(string.char(string.byte(id,1)-1).."z"); | ||
else print(string.sub(id,0,1)..string.char(string.byte(id,2)-1)); | else print(string.sub(id,0,1)..string.char(string.byte(id,2)-1)); | ||
end | end | ||
− | end | + | end | {{{2|zz}}} }} |
− | | {{{2| | + | |
|Index/name|{{{3}}}|{{{4|}}} }} | |Index/name|{{{3}}}|{{{4|}}} }} | ||
|align=center| [[Index:{{{3}}} | |align=center| [[Index:{{{3}}} | ||
Line 44: | Line 44: | ||
| {{{2|az}}} }} | | {{{2|az}}} }} | ||
|Index/name|{{{3}}}|{{{4|}}}}} | |Index/name|{{{3}}}|{{{4|}}}}} | ||
− | |} | + | |}----> |
{| class="wikitable" style="width=100%; margin: 1em auto; border-width:0px 0px 0px 0px;" | {| class="wikitable" style="width=100%; margin: 1em auto; border-width:0px 0px 0px 0px;" | ||
Line 50: | Line 50: | ||
{{#repeat:IndexTable|1| | {{#repeat:IndexTable|1| | ||
{{#lua: | {{#lua: | ||
+ | local first = stdin:match("%S+"); | ||
+ | local last = stdin:match("%S+"); | ||
local hash = {}; | local hash = {}; | ||
local idx = {}; | local idx = {}; | ||
for id, names in stdin:gmatch("&&(%w+)&&(.+)") do | for id, names in stdin:gmatch("&&(%w+)&&(.+)") do | ||
for word in string.gmatch("&&[%(%)%[%]%+%-%d%p\"']*([%a]+)[^&]*") do | for word in string.gmatch("&&[%(%)%[%]%+%-%d%p\"']*([%a]+)[^&]*") do | ||
− | if ((string.sub(word,0,1) == string.sub( | + | if ((string.sub(word,0,1) == string.sub(first,0,1)) and |
− | (string.byte( | + | (string.byte(first,2) <= string.byte(word,2)) and |
− | (string.byte( | + | (string.byte(last,2) >= string.byte(word,2))) |
then hash[word] = id; table.insert(idx,word); | then hash[word] = id; table.insert(idx,word); | ||
end | end | ||
Line 67: | Line 69: | ||
end | end | ||
print(output); | print(output); | ||
− | |{{#SearchLine:Common Name=||{{{3}}}}} }} | + | |{{{1}}} {{{2}}} {{#SearchLine:Common Name=||{{{3}}}}} }} |
}} | }} | ||
}} | }} | ||
|} | |} |
Revision as of 15:33, 1 October 2008
名前のインデクス {{{1}}} 最小値(デフォルトaa) {{{2}}} 最大値(デフォルトab) {{{3}}} ページタイトル {{{4}}}ダミー Last updated: 20081001153324