Modul:X: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(132 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 2: | Zeile 2: | ||
function split (inputstr, sep) | function split (inputstr, sep) | ||
if sep == nil then | if sep == nil then | ||
sep = "%s" | sep = "%s" | ||
Zeile 11: | Zeile 12: | ||
return t | return t | ||
end | end | ||
function tablelength(T) | |||
local count = 0 | |||
for _ in pairs(T) do count = count + 1 end | |||
return count | |||
end | |||
function p.cut( frame ) | function p.cut( frame ) | ||
testtext = "" | |||
realtext = frame.args[2] -- | realtext = frame.args[2] --Die Schmiede | ||
realtext = removespaceinlink(realtext) | realtext = removespaceinlink(realtext) --Die Schmiede | ||
srealtext = split(realtext, " ") -- | srealtext = split(realtext, " ") --Die|Schmiede(list) | ||
i = 2; --2 | i = 2; --2 | ||
limit = tonumber(frame.args[1]) -- | testtext = testtext.."<br \>"..i..": " | ||
text = display(realtext) -- | limit = tonumber(frame.args[1]) --4 | ||
stext = split(text, " ") -- | text = display(removespaceinlink(realtext)) --Die Schmiede | ||
stext = split(text, " ") --Die|Schmiede(list) | |||
if(table.getn(stext)==1) then | if(table.getn(stext)==1) then | ||
Zeile 30: | Zeile 39: | ||
end | end | ||
cuttext = stext[1] -- | cuttext = stext[1] --Die | ||
realcuttext = srealtext[1] -- | realcuttext = srealtext[1] --Die | ||
nextlen = string.len(nextwo)-- | nextwo = stext[2] --Schmiede | ||
textlen = string.len(text)-- | realnextwo = srealtext[2] --Schmiede | ||
cuttextlen = string.len(cuttext)-- | |||
nextlen = string.len(nextwo)--8 | |||
textlen = string.len(text)--12 | |||
cuttextlen = string.len(cuttext)--3 | |||
set = true; | set = true; | ||
testtext = testtext.."<br \>"..i..": "..realcuttext | |||
if(limit>=textlen)then -- | if(limit>=textlen)then --4>=12 | ||
return realtext.."%@%" | return realtext.."%@%" | ||
elseif(cuttextlen>limit) then-- | elseif(cuttextlen>limit) then--3>4 | ||
return "%@%"..realtext | return "%@%"..realtext | ||
else | else | ||
while (cuttextlen+nextlen+1<=textlen+2) do --8+3+1<=12+2(12<=14)|14+3+1<=12+2(18<=14) | |||
while (cuttextlen+nextlen+1<=textlen+2) do -- | |||
if(cuttextlen+nextlen+1>limit and set) then -- | if(cuttextlen+nextlen+1>limit and set) then --8+3+1>4(12>4)| | ||
set = false | set = false | ||
cuttext = cuttext.."%@%" -- | cuttext = cuttext.."%@%" --"Die %@%" | ||
realcuttext = realcuttext.."%@%" -- | realcuttext = realcuttext.."%@%" --"Die %@%" | ||
else | else | ||
cuttext = cuttext.." " -- | cuttext = cuttext.." " -- | ||
realcuttext = realcuttext.." " -- | realcuttext = realcuttext.." " -- | ||
end | end | ||
testtext = testtext..tostring(i)..": "..realcuttext.."<br />" | -- testtext = testtext..tostring(i)..": "..realcuttext.."<br />" | ||
i = i + 1 --3 | i = i + 1 --3 | ||
cuttext = cuttext..nextwo -- | cuttext = cuttext..nextwo -- "Die%@%Schmiede" | ||
realcuttext = realcuttext..realnextwo -- | realcuttext = realcuttext..realnextwo -- "Die%@%Schmiede" | ||
nextwo = stext[i]-- | nextwo = stext[i]-- nil | ||
realnextwo = srealtext[i]-- | realnextwo = srealtext[i]-- nil | ||
if (nextwo ~= nil) then | if (nextwo ~= nil) then | ||
nextlen = string.len(nextwo) -- 5 | nextlen = string.len(nextwo) -- 5 | ||
end | end | ||
cuttextlen = string.len(cuttext) -- | cuttextlen = string.len(cuttext) -- 14 | ||
testtext = testtext.."<br \>"..i..": "..realcuttext | |||
end | end | ||
realnextwo = srealtext[i] | |||
if (realnextwo ~= nil) then | if (realnextwo ~= nil) then | ||
realcuttext = realcuttext.." "..realnextwo | realcuttext = realcuttext.." "..realnextwo | ||
end | end | ||
end | end | ||
testtext = testtext.."<br \>"..(i+1)..": "..realcuttext | |||
return realcuttext | return realcuttext | ||
end | end | ||
Zeile 89: | Zeile 101: | ||
function cut( limit, realtext ) | function cut( limit, realtext ) | ||
realtext = removespaceinlink(realtext) | testtext = "" | ||
srealtext = split(realtext, " ") -- | |||
realtext = removespaceinlink(realtext) --Die Schmiede | |||
srealtext = split(realtext, " ") --Die|Schmiede(list) | |||
i = 2; --2 | i = 2; --2 | ||
text = display(realtext) -- | testtext = testtext.."<br \>"..i..": " | ||
stext = split(text, " ") -- | |||
text = display(removespaceinlink(realtext)) --Die Schmiede | |||
stext = split(text, " ") --Die|Schmiede(list) | |||
if(table.getn(stext)==1) then | if(table.getn(stext)==1) then | ||
Zeile 103: | Zeile 119: | ||
end | end | ||
cuttext = stext[1] -- | cuttext = stext[1] --Die | ||
realcuttext = srealtext[1] -- | realcuttext = srealtext[1] --Die | ||
nextwo = stext[2] -- | nextwo = stext[2] --Schmiede | ||
realnextwo = srealtext[2] -- | realnextwo = srealtext[2] --Schmiede | ||
nextlen = string.len(nextwo)-- | nextlen = string.len(nextwo)--8 | ||
textlen = string.len(text)-- | textlen = string.len(text)--12 | ||
cuttextlen = string.len(cuttext)-- | cuttextlen = string.len(cuttext)--3 | ||
set = true; | set = true; | ||
testtext = testtext.."<br \>"..i..": "..realcuttext | |||
if(limit>=textlen)then -- | if(limit>=textlen)then --4>=12 | ||
return realtext.."%@%" | return realtext.."%@%" | ||
elseif(cuttextlen>limit) then-- | elseif(cuttextlen>limit) then--3>4 | ||
return "%@%"..realtext | return "%@%"..realtext | ||
else | else | ||
while (cuttextlen+nextlen+1<=textlen+2) do --8+3+1<=12+2(12<=14)|14+3+1<=12+2(18<=14) | |||
while (cuttextlen+nextlen+1<=textlen+2) do -- | |||
if(cuttextlen+nextlen+1>limit and set) then -- | if(cuttextlen+nextlen+1>limit and set) then --8+3+1>4(12>4)| | ||
set = false | set = false | ||
cuttext = cuttext.."%@%" -- | cuttext = cuttext.."%@%" --"Die %@%" | ||
realcuttext = realcuttext.."%@%" -- | realcuttext = realcuttext.."%@%" --"Die %@%" | ||
else | else | ||
cuttext = cuttext.." " -- | cuttext = cuttext.." " -- | ||
realcuttext = realcuttext.." " -- | realcuttext = realcuttext.." " -- | ||
end | end | ||
-- testtext = testtext..tostring(i)..": "..realcuttext.."<br />" | |||
i = i + 1 --3 | i = i + 1 --3 | ||
cuttext = cuttext..nextwo -- | cuttext = cuttext..nextwo -- "Die%@%Schmiede" | ||
realcuttext = realcuttext..realnextwo -- | realcuttext = realcuttext..realnextwo -- "Die%@%Schmiede" | ||
nextwo = stext[i]-- | nextwo = stext[i]-- nil | ||
realnextwo = srealtext[i]-- | realnextwo = srealtext[i]-- nil | ||
if (nextwo ~= nil) then | if (nextwo ~= nil) then | ||
nextlen = string.len(nextwo) -- 5 | nextlen = string.len(nextwo) -- 5 | ||
end | end | ||
cuttextlen = string.len(cuttext) -- | cuttextlen = string.len(cuttext) -- 14 | ||
testtext = testtext.."<br \>"..i..": "..realcuttext | |||
end | end | ||
realnextwo = srealtext[i] | |||
if (realnextwo ~= nil) then | if (realnextwo ~= nil) then | ||
realcuttext = realcuttext.." "..realnextwo | realcuttext = realcuttext.." "..realnextwo | ||
end | end | ||
end | end | ||
testtext = testtext.."<br \>"..(i+1)..": "..realcuttext | |||
return realcuttext | return realcuttext | ||
end | end | ||
Zeile 162: | Zeile 181: | ||
function p.cutblock ( frame ) | function p.cutblock ( frame ) | ||
text = frame.args[3] | text = frame.args[3]-- "Die Schmiede" | ||
width = tonumber(frame.args[2]) | width = tonumber(frame.args[2]) -- 4 | ||
height = tonumber(frame.args[1]) | height = tonumber(frame.args[1]) -- 12 | ||
block = "" | block = "" | ||
textlen = string.len(text) | textlen = string.len(text) -- 12 | ||
tempsplit = {} | tempsplit = {} | ||
while (height>0 and textlen>=width) do | while (height>0 and textlen>=width) do -- 12>0 and 12>=4|11>0 and 11>=4 | ||
tempsplit = split(cut(width, text), "%%%@%%") | tempsplit = split(cut(width, text), "%%%@%%") -- ("Die", "Schmiede")| ( | ||
block = block..tempsplit[1].." " | block = block..tempsplit[1].." " -- "Die " | ||
text = tempsplit[2] | text = tempsplit[2] -- "Schmiede" | ||
height = height-1 | height = height-1 -- 11 | ||
textlen = string.len(text) | if (text==nil) then | ||
text = "" | |||
end | |||
textlen = string.len(text) -- 8 | |||
end | end | ||
if (height>0) then | if (height>0) then | ||
Zeile 182: | Zeile 204: | ||
end | end | ||
result = block.."%@%"..text | |||
result = string.gsub(result, "%§", " ") | |||
return result | |||
Zeile 191: | Zeile 214: | ||
text = frame.args[1] | text = frame.args[1] | ||
text = text:gsub("'", "") | text = text:gsub("'", "") | ||
text = text | lend = string.len(text) | ||
i=1 | |||
text = text:gsub("%[", "") | auf = {} | ||
text = text:gsub("%|", "") | zu = {} | ||
currentauf = string.find(text, "%[%[") | |||
while (currentauf ~= nil) do | |||
auf[i] = currentauf; | |||
if (string.find(string.sub(text,currentauf+2), "%[%[")~=nil)then | |||
currentauf = currentauf+1+string.find(string.sub(text,currentauf+2), "%[%[") | |||
else | |||
currentauf = nil | |||
end | |||
i=i+1 | |||
end | |||
i=1 | |||
currentzu = string.find(text, "%|") | |||
while (currentzu ~= nil) do | |||
zu[i] = currentzu; | |||
if (string.find(string.sub(text,currentzu+2), "%|")~=nil)then | |||
currentzu = currentzu+1+string.find(string.sub(text,currentzu+2), "%|") | |||
else | |||
currentzu = nil | |||
end | |||
i=i+1 | |||
end | |||
offset = 0 | |||
if(table.getn(auf) == table.getn(zu))then | |||
i=1 | |||
while (table.getn(auf)>=i) do | |||
anfang = auf[i] | |||
ende = zu[i] | |||
tt, uu = string.find(string.sub(text, 1, anfang-offset+1), "%[%[(.+)%|") | |||
text = string.gsub(string.sub(text, 1, anfang-offset+1), "%[%[(.+)%|", "")..string.sub(text,anfang-offset+2,string.len(text)) | |||
-- text = string.sub(text,1,anfang-offset+1)..string.sub(text,ende+1-offset,string.len(text)) | |||
if (tt ~= nil) and (uu ~= nil) then | |||
offset = offset+uu-tt | |||
end | |||
i=i+1 | |||
end | |||
text = string.gsub(text, "%[%[(.+)%|", "") | |||
end | |||
-- text = text:gsub("%[", "") | |||
-- text = text:gsub("%|", "") | |||
text = text:gsub("%]", "") | text = text:gsub("%]", "") | ||
return text | return text | ||
Zeile 202: | Zeile 271: | ||
function display ( text ) | function display ( text ) | ||
text = text:gsub("'", "") | text = text:gsub("'", "") | ||
text = text | lend = string.len(text) | ||
ii=1 | |||
text = text:gsub("%[", "") | auf = {} | ||
text = text:gsub("%|", "") | zu = {} | ||
currentauf = string.find(text, "%[%[") | |||
while (currentauf ~= nil) do | |||
auf[ii] = currentauf; | |||
if (string.find(string.sub(text,currentauf+2), "%[%[")~=nil)then | |||
currentauf = currentauf+1+string.find(string.sub(text,currentauf+2), "%[%[") | |||
else | |||
currentauf = nil | |||
end | |||
ii=ii+1 | |||
end | |||
ii=1 | |||
currentzu = string.find(text, "%|") | |||
while (currentzu ~= nil) do | |||
zu[ii] = currentzu; | |||
if (string.find(string.sub(text,currentzu+2), "%|")~=nil)then | |||
currentzu = currentzu+1+string.find(string.sub(text,currentzu+2), "%|") | |||
else | |||
currentzu = nil | |||
end | |||
ii=ii+1 | |||
end | |||
offset = 0 | |||
if(table.getn(auf) == table.getn(zu))then | |||
ii=1 | |||
while (table.getn(auf)>=ii) do | |||
anfang = auf[ii] | |||
ende = zu[ii] | |||
tt, uu = string.find(string.sub(text, 1, anfang-offset+1), "%[%[(.+)%|") | |||
text = string.gsub(string.sub(text, 1, anfang-offset+1), "%[%[(.+)%|", "")..string.sub(text,anfang-offset+2,string.len(text)) | |||
-- text = string.sub(text,1,anfang-offset+1)..string.sub(text,ende+1-offset,string.len(text)) | |||
if (tt ~= nil) and (uu ~= nil) then | |||
offset = offset+uu-tt | |||
end | |||
ii=ii+1 | |||
end | |||
text = string.gsub(text, "%[%[(.+)%|", "") | |||
end | |||
-- text = text:gsub("%[", "") | |||
-- text = text:gsub("%|", "") | |||
text = text:gsub("%]", "") | text = text:gsub("%]", "") | ||
return text | return text | ||
Zeile 212: | Zeile 327: | ||
function removespaceinlink(text) | function removespaceinlink(text) | ||
iii=1 | |||
auf = {} | auf = {} | ||
zu = {} | zu = {} | ||
currentauf = string.find(text, "%[%[") | currentauf = string.find(text, "%[%[") | ||
while (currentauf ~= nil) do | while (currentauf ~= nil) do | ||
auf[ | auf[iii] = currentauf; | ||
if (string.find(string.sub(text,currentauf+2), "%[%[")~=nil)then | if (string.find(string.sub(text,currentauf+2), "%[%[")~=nil)then | ||
currentauf = currentauf+1+string.find(string.sub(text,currentauf+2), "%[%[") | currentauf = currentauf+1+string.find(string.sub(text,currentauf+2), "%[%[") | ||
Zeile 224: | Zeile 339: | ||
end | end | ||
iii=iii+1 | |||
end | end | ||
iii=1 | |||
currentzu = string.find(text, "%]%]") | currentzu = string.find(text, "%]%]") | ||
while (currentzu ~= nil) do | while (currentzu ~= nil) do | ||
zu[ | zu[iii] = currentzu; | ||
if (string.find(string.sub(text,currentzu+2), "%]%]")~=nil)then | if (string.find(string.sub(text,currentzu+2), "%]%]")~=nil)then | ||
currentzu = currentzu+1+string.find(string.sub(text,currentzu+2), "%]%]") | currentzu = currentzu+1+string.find(string.sub(text,currentzu+2), "%]%]") | ||
Zeile 236: | Zeile 351: | ||
currentzu = nil | currentzu = nil | ||
end | end | ||
iii=iii+1 | |||
end | end | ||
if(table.getn(auf) == table.getn(zu))then | if(table.getn(auf) == table.getn(zu))then | ||
iii=1 | |||
while (table.getn(auf)>= | while (table.getn(auf)>=iii) do | ||
anfang = auf[ | anfang = auf[iii] | ||
ende = zu[ | ende = zu[iii] | ||
text = string.sub(text,1,anfang-1)..string.gsub(string.sub(text,anfang,ende)," ","§")..string.sub(text,ende+1,string.len(text)) | text = string.sub(text,1,anfang-1)..string.gsub(string.sub(text,anfang,ende)," ","§")..string.sub(text,ende+1,string.len(text)) | ||
iii=iii+1 | |||
end | end | ||
end | end | ||
Zeile 252: | Zeile 367: | ||
end | end | ||
function p.removespaceinlink( frame ) | function p.removespaceinlink(frame) | ||
text = frame.args[1] | text = frame.args[1] | ||
i=1 | i=1 | ||
Zeile 285: | Zeile 400: | ||
anfang = auf[i] | anfang = auf[i] | ||
ende = zu[i] | ende = zu[i] | ||
text = string.sub(text,1,anfang-1)..string.gsub(string.sub(text,anfang,ende)," ","§")..string.sub(text,ende+1,string.len(text)) | text = string.sub(text,1,anfang-1)..string.gsub(string.sub(text,anfang,ende)," ","§")..string.sub(text,ende+1,string.len(text)) | ||
i=i+1 | i=i+1 | ||
Zeile 320: | Zeile 435: | ||
end | end | ||
function p.index( frame ) | |||
text = frame.args[1] | |||
stext = split (text, "\n") | |||
ending = "" | |||
for i = 1,tablelength(stext),1 do | |||
currentsplit = split (stext[i], "%>") | |||
leng = tablelength(currentsplit) | |||
ending = ending.."|<big>'''[[Yggdrasil:"..currentsplit[2].."#"..currentsplit[1].."|"..currentsplit[1].."]]'''</big>\n|<big>'''[[Yggdrasil:"..currentsplit[2].."|"..currentsplit[2].."]]'''</big>\n|-\n" | |||
end | |||
return ending | |||
end | |||
function p.yggrassen( frame ) | |||
text = frame.args[1] | |||
stext = split (text, "\n") | |||
haupttext = split (text, "'''Nebenrassen'''")[1] | |||
nebentext = split (text, "'''Nebenrassen'''")[2] | |||
shaupttext = split (haupttext, "\n") | |||
snebentext = split (nebentext, "\n") | |||
ending = "!<big>Hauptrassen</big>\n|-\n" | |||
for i = 2,tablelength(stext),1 do | |||
if (stext[i]=="'''Nebenrassen'''") then | |||
ending = ending.."!<big>Nebenrassen</big>\n|-\n" | |||
else | |||
ending = ending.."|<big>'''[[#"..stext[i].."|"..stext[i].."]]'''</big>\n|-\n" | |||
end | |||
end | |||
return ending | |||
end | |||
return p | return p |
Version vom 5. März 2020, 22:17 Uhr
Die Dokumentation für dieses Modul kann unter Modul:X/Doku erstellt werden
local p = {} --local p = {} -- p steht für Paket (engl. package)
function split (inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
function p.cut( frame )
testtext = ""
realtext = frame.args[2] --Die Schmiede
realtext = removespaceinlink(realtext) --Die Schmiede
srealtext = split(realtext, " ") --Die|Schmiede(list)
i = 2; --2
testtext = testtext.."<br \>"..i..": "
limit = tonumber(frame.args[1]) --4
text = display(removespaceinlink(realtext)) --Die Schmiede
stext = split(text, " ") --Die|Schmiede(list)
if(table.getn(stext)==1) then
if(string.len(stext[1])>limit) then
return "%@%"..text
else
return text.."%@%"
end
end
cuttext = stext[1] --Die
realcuttext = srealtext[1] --Die
nextwo = stext[2] --Schmiede
realnextwo = srealtext[2] --Schmiede
nextlen = string.len(nextwo)--8
textlen = string.len(text)--12
cuttextlen = string.len(cuttext)--3
set = true;
testtext = testtext.."<br \>"..i..": "..realcuttext
if(limit>=textlen)then --4>=12
return realtext.."%@%"
elseif(cuttextlen>limit) then--3>4
return "%@%"..realtext
else
while (cuttextlen+nextlen+1<=textlen+2) do --8+3+1<=12+2(12<=14)|14+3+1<=12+2(18<=14)
if(cuttextlen+nextlen+1>limit and set) then --8+3+1>4(12>4)|
set = false
cuttext = cuttext.."%@%" --"Die %@%"
realcuttext = realcuttext.."%@%" --"Die %@%"
else
cuttext = cuttext.." " --
realcuttext = realcuttext.." " --
end
-- testtext = testtext..tostring(i)..": "..realcuttext.."<br />"
i = i + 1 --3
cuttext = cuttext..nextwo -- "Die%@%Schmiede"
realcuttext = realcuttext..realnextwo -- "Die%@%Schmiede"
nextwo = stext[i]-- nil
realnextwo = srealtext[i]-- nil
if (nextwo ~= nil) then
nextlen = string.len(nextwo) -- 5
end
cuttextlen = string.len(cuttext) -- 14
testtext = testtext.."<br \>"..i..": "..realcuttext
end
realnextwo = srealtext[i]
if (realnextwo ~= nil) then
realcuttext = realcuttext.." "..realnextwo
end
end
testtext = testtext.."<br \>"..(i+1)..": "..realcuttext
return realcuttext
end
function cut( limit, realtext )
testtext = ""
realtext = removespaceinlink(realtext) --Die Schmiede
srealtext = split(realtext, " ") --Die|Schmiede(list)
i = 2; --2
testtext = testtext.."<br \>"..i..": "
text = display(removespaceinlink(realtext)) --Die Schmiede
stext = split(text, " ") --Die|Schmiede(list)
if(table.getn(stext)==1) then
if(string.len(stext[1])>limit) then
return "%@%"..text
else
return text.."%@%"
end
end
cuttext = stext[1] --Die
realcuttext = srealtext[1] --Die
nextwo = stext[2] --Schmiede
realnextwo = srealtext[2] --Schmiede
nextlen = string.len(nextwo)--8
textlen = string.len(text)--12
cuttextlen = string.len(cuttext)--3
set = true;
testtext = testtext.."<br \>"..i..": "..realcuttext
if(limit>=textlen)then --4>=12
return realtext.."%@%"
elseif(cuttextlen>limit) then--3>4
return "%@%"..realtext
else
while (cuttextlen+nextlen+1<=textlen+2) do --8+3+1<=12+2(12<=14)|14+3+1<=12+2(18<=14)
if(cuttextlen+nextlen+1>limit and set) then --8+3+1>4(12>4)|
set = false
cuttext = cuttext.."%@%" --"Die %@%"
realcuttext = realcuttext.."%@%" --"Die %@%"
else
cuttext = cuttext.." " --
realcuttext = realcuttext.." " --
end
-- testtext = testtext..tostring(i)..": "..realcuttext.."<br />"
i = i + 1 --3
cuttext = cuttext..nextwo -- "Die%@%Schmiede"
realcuttext = realcuttext..realnextwo -- "Die%@%Schmiede"
nextwo = stext[i]-- nil
realnextwo = srealtext[i]-- nil
if (nextwo ~= nil) then
nextlen = string.len(nextwo) -- 5
end
cuttextlen = string.len(cuttext) -- 14
testtext = testtext.."<br \>"..i..": "..realcuttext
end
realnextwo = srealtext[i]
if (realnextwo ~= nil) then
realcuttext = realcuttext.." "..realnextwo
end
end
testtext = testtext.."<br \>"..(i+1)..": "..realcuttext
return realcuttext
end
function p.cutblock ( frame )
text = frame.args[3]-- "Die Schmiede"
width = tonumber(frame.args[2]) -- 4
height = tonumber(frame.args[1]) -- 12
block = ""
textlen = string.len(text) -- 12
tempsplit = {}
while (height>0 and textlen>=width) do -- 12>0 and 12>=4|11>0 and 11>=4
tempsplit = split(cut(width, text), "%%%@%%") -- ("Die", "Schmiede")| (
block = block..tempsplit[1].." " -- "Die "
text = tempsplit[2] -- "Schmiede"
height = height-1 -- 11
if (text==nil) then
text = ""
end
textlen = string.len(text) -- 8
end
if (height>0) then
block = block.." "..text
text = ""
end
result = block.."%@%"..text
result = string.gsub(result, "%§", " ")
return result
end
function p.display ( frame )
text = frame.args[1]
text = text:gsub("'", "")
lend = string.len(text)
i=1
auf = {}
zu = {}
currentauf = string.find(text, "%[%[")
while (currentauf ~= nil) do
auf[i] = currentauf;
if (string.find(string.sub(text,currentauf+2), "%[%[")~=nil)then
currentauf = currentauf+1+string.find(string.sub(text,currentauf+2), "%[%[")
else
currentauf = nil
end
i=i+1
end
i=1
currentzu = string.find(text, "%|")
while (currentzu ~= nil) do
zu[i] = currentzu;
if (string.find(string.sub(text,currentzu+2), "%|")~=nil)then
currentzu = currentzu+1+string.find(string.sub(text,currentzu+2), "%|")
else
currentzu = nil
end
i=i+1
end
offset = 0
if(table.getn(auf) == table.getn(zu))then
i=1
while (table.getn(auf)>=i) do
anfang = auf[i]
ende = zu[i]
tt, uu = string.find(string.sub(text, 1, anfang-offset+1), "%[%[(.+)%|")
text = string.gsub(string.sub(text, 1, anfang-offset+1), "%[%[(.+)%|", "")..string.sub(text,anfang-offset+2,string.len(text))
-- text = string.sub(text,1,anfang-offset+1)..string.sub(text,ende+1-offset,string.len(text))
if (tt ~= nil) and (uu ~= nil) then
offset = offset+uu-tt
end
i=i+1
end
text = string.gsub(text, "%[%[(.+)%|", "")
end
-- text = text:gsub("%[", "")
-- text = text:gsub("%|", "")
text = text:gsub("%]", "")
return text
end
function display ( text )
text = text:gsub("'", "")
lend = string.len(text)
ii=1
auf = {}
zu = {}
currentauf = string.find(text, "%[%[")
while (currentauf ~= nil) do
auf[ii] = currentauf;
if (string.find(string.sub(text,currentauf+2), "%[%[")~=nil)then
currentauf = currentauf+1+string.find(string.sub(text,currentauf+2), "%[%[")
else
currentauf = nil
end
ii=ii+1
end
ii=1
currentzu = string.find(text, "%|")
while (currentzu ~= nil) do
zu[ii] = currentzu;
if (string.find(string.sub(text,currentzu+2), "%|")~=nil)then
currentzu = currentzu+1+string.find(string.sub(text,currentzu+2), "%|")
else
currentzu = nil
end
ii=ii+1
end
offset = 0
if(table.getn(auf) == table.getn(zu))then
ii=1
while (table.getn(auf)>=ii) do
anfang = auf[ii]
ende = zu[ii]
tt, uu = string.find(string.sub(text, 1, anfang-offset+1), "%[%[(.+)%|")
text = string.gsub(string.sub(text, 1, anfang-offset+1), "%[%[(.+)%|", "")..string.sub(text,anfang-offset+2,string.len(text))
-- text = string.sub(text,1,anfang-offset+1)..string.sub(text,ende+1-offset,string.len(text))
if (tt ~= nil) and (uu ~= nil) then
offset = offset+uu-tt
end
ii=ii+1
end
text = string.gsub(text, "%[%[(.+)%|", "")
end
-- text = text:gsub("%[", "")
-- text = text:gsub("%|", "")
text = text:gsub("%]", "")
return text
end
function removespaceinlink(text)
iii=1
auf = {}
zu = {}
currentauf = string.find(text, "%[%[")
while (currentauf ~= nil) do
auf[iii] = currentauf;
if (string.find(string.sub(text,currentauf+2), "%[%[")~=nil)then
currentauf = currentauf+1+string.find(string.sub(text,currentauf+2), "%[%[")
else
currentauf = nil
end
iii=iii+1
end
iii=1
currentzu = string.find(text, "%]%]")
while (currentzu ~= nil) do
zu[iii] = currentzu;
if (string.find(string.sub(text,currentzu+2), "%]%]")~=nil)then
currentzu = currentzu+1+string.find(string.sub(text,currentzu+2), "%]%]")
else
currentzu = nil
end
iii=iii+1
end
if(table.getn(auf) == table.getn(zu))then
iii=1
while (table.getn(auf)>=iii) do
anfang = auf[iii]
ende = zu[iii]
text = string.sub(text,1,anfang-1)..string.gsub(string.sub(text,anfang,ende)," ","§")..string.sub(text,ende+1,string.len(text))
iii=iii+1
end
end
return text
end
function p.removespaceinlink(frame)
text = frame.args[1]
i=1
auf = {}
zu = {}
currentauf = string.find(text, "%[%[")
while (currentauf ~= nil) do
auf[i] = currentauf;
if (string.find(string.sub(text,currentauf+2), "%[%[")~=nil)then
currentauf = currentauf+1+string.find(string.sub(text,currentauf+2), "%[%[")
else
currentauf = nil
end
i=i+1
end
i=1
currentzu = string.find(text, "%]%]")
while (currentzu ~= nil) do
zu[i] = currentzu;
if (string.find(string.sub(text,currentzu+2), "%]%]")~=nil)then
currentzu = currentzu+1+string.find(string.sub(text,currentzu+2), "%]%]")
else
currentzu = nil
end
i=i+1
end
if(table.getn(auf) == table.getn(zu))then
i=1
while (table.getn(auf)>=i) do
anfang = auf[i]
ende = zu[i]
text = string.sub(text,1,anfang-1)..string.gsub(string.sub(text,anfang,ende)," ","§")..string.sub(text,ende+1,string.len(text))
i=i+1
end
end
return text
end
function p.size ( frame )
text = frame.args[1]
return textSize(text)
end
function p.size ( frame )
text = frame.args[1]
return textSize(text)
end
function p.findg( frame )
text = frame.args[1]
d,s,r = string.find(text, "g")
return d,s,r
end
function p.index( frame )
text = frame.args[1]
stext = split (text, "\n")
ending = ""
for i = 1,tablelength(stext),1 do
currentsplit = split (stext[i], "%>")
leng = tablelength(currentsplit)
ending = ending.."|<big>'''[[Yggdrasil:"..currentsplit[2].."#"..currentsplit[1].."|"..currentsplit[1].."]]'''</big>\n|<big>'''[[Yggdrasil:"..currentsplit[2].."|"..currentsplit[2].."]]'''</big>\n|-\n"
end
return ending
end
function p.yggrassen( frame )
text = frame.args[1]
stext = split (text, "\n")
haupttext = split (text, "'''Nebenrassen'''")[1]
nebentext = split (text, "'''Nebenrassen'''")[2]
shaupttext = split (haupttext, "\n")
snebentext = split (nebentext, "\n")
ending = "!<big>Hauptrassen</big>\n|-\n"
for i = 2,tablelength(stext),1 do
if (stext[i]=="'''Nebenrassen'''") then
ending = ending.."!<big>Nebenrassen</big>\n|-\n"
else
ending = ending.."|<big>'''[[#"..stext[i].."|"..stext[i].."]]'''</big>\n|-\n"
end
end
return ending
end
return p