Modul:X: Unterschied zwischen den Versionen

Aus How to be a Hero
Zur Navigation springen Zur Suche springen
(233 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] --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
i = 2; --2
limit = tonumber(frame.args[1]) --9
testtext = testtext.."<br \>"..i..": "
text = frame.args[2] --fiick dich halli
stext = split(text, " ")--fiick|dich|halli(list)
text = display(removespaceinlink(realtext)) --Die Schmiede
cuttext = stext[1]--fiick
stext = split(text, " ") --Die|Schmiede(list)
nextwo = stext[2]--dich
nextlen = string.len(nextwo)--4
if(table.getn(stext)==1) then
textlen = string.len(text)--15
if(string.len(stext[1])>limit) then
cuttextlen = string.len(cuttext)--5
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;
set = true;
if(limit>=textlen)then --9>=15
testtext = testtext.."<br \>"..i..": "..realcuttext
return text.."%@%"
elseif(cuttextlen>limit) then--5>9
return "%@%"..text
if(limit>=textlen)then --4>=12
return realtext.."%@%"
elseif(cuttextlen>limit) then--3>4
return "%@%"..realtext
else
else
while (cuttextlen+nextlen+1<textlen+2) do --5+4+1<15+2(10<17) | 11+5+1<15+2
while (cuttextlen+nextlen+1<=textlen+2) do --8+3+1<=12+2(12<=14)|14+3+1<=12+2(18<=14)
if(cuttextlen+nextlen>=limit and set) then --5+4>9(9>=9)
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.."%@%" --"Die %@%"
else
else
cuttext = cuttext.." "
cuttext = cuttext.." " --
realcuttext = realcuttext.." " --
end
end
-- testtext = testtext..tostring(i)..": "..realcuttext.."<br />"
i = i + 1 --3
i = i + 1 --3
cuttext = cuttext..nextwo -- fick%@%dich
nextwo = stext[i]-- halli
cuttext = cuttext..nextwo -- "Die%@%Schmiede"
nextlen = string.len(nextwo) -- 5
realcuttext = realcuttext..realnextwo -- "Die%@%Schmiede"
cuttextlen = string.len(cuttext) -- 11
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
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
return cuttext
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
end
-- text = text:gsub("%[", "")
-- text = text:gsub("%|", "")
text = text:gsub("%]", "")
return text
end
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
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