Modül:Futbol sezonu maç sonuçları

Modül belgelemesi[oluştur]
local p = {}

function p.matchPlaces(frame)
	local team = frame.args[1]  
	local league = frame.args[2]
	local count = frame.args[3]  
	 local countMatch=0
		local results = {}  
	local templateName = "Şablon:"..league.." maçları/maçlar"  
	local templatePage = mw.title.new(templateName)
    local content = templatePage:getContent()
    	local pattern = "|(...)-(...)%s=%s\n{{Kapanabilir futbol maçı kutusu\n|tarih%s*=%s*([^\n]*)\n|zaman%s*=%s*([^|]*)\n|tur%s*=%s*(%d+)\n|takım1%s*=%s*([^\n]*)\n|sonuç%s*=%s*([^|]*)"

	  for m1, m2, m3,m4,m5,m6,m7 in mw.ustring.gmatch(content,pattern) do
				if team==m1 or team==m2 then
							countMatch=countMatch+1

					local result
					
					if string.find(m7,"Y") then
						result=" "
					elseif m1==team then
						result="E"
					elseif m2==team then
						result="D"
					
					end	
				
						
					 table.insert(results, result)
				if countMatch~=tonumber(count) then
					table.insert(results, "/ ")
					end
						end	
				

		end

	  
	return table.concat(results," ")

end

function p.matches(frame)
	local team = frame.args[1]  
	local league = frame.args[2]
	 local count = frame.args[3]  
	 local countMatch=0
	local results = {}  
	local templateName = "Şablon:"..league.." maçları/maçlar"  
	local templatePage = mw.title.new(templateName)
    local content = templatePage:getContent()
    	local pattern = "|(...)-(...)%s=%s\n{{Kapanabilir futbol maçı kutusu\n|tarih%s*=%s*([^\n]*)\n|zaman%s*=%s*([^|]*)\n|tur%s*=%s*(%d+)\n|takım1%s*=%s*([^\n]*)\n|sonuç%s*=%s*([^|]*)"

	  for m1, m2, m3,m4,m5,m6,m7 in mw.ustring.gmatch(content,pattern) do
				if team==m1 or team==m2 then
							countMatch=countMatch+1

					local result
					if m7=='' then
						result=" "
					end
					if string.find(m7,"ERT") then
						result="P"
					end
					if string.find(m7,"Y") then
						result="İ"
					end
					local pattern2 = "(%d+)%s*-%s*(%d+)"
						for num1, num2 in mw.ustring.gmatch(m7,pattern2) do
							                
                if team == m1 then
                    result = (num1 > num2 and "G") or (num1 < num2 and "M") or "B"
                elseif team == m2 then
                    result = (num1 > num2 and "M") or (num1 < num2 and "G") or "B"
                end

						end
						if countMatch==1 then
							table.insert(results, frame:preprocess("=== İlk devre ==="))
							end
						
						if result~="İ" then
				 table.insert(results,"{{"..league.." maçları|"..m1.."-"..m2.."|".. result.."}}")
				 else
				 	table.insert(results,"{{BAY|"..countMatch.."}}")
				 	end
				if countMatch==tonumber(count)/2 then
					table.insert(results, frame:preprocess("=== İkinci devre ==="))
					end

		end

	  end
	return mw.text.trim(frame:preprocess(table.concat(results,"\n")))
	end

function p.getMatchResults(frame)
	local team = frame.args[1]  
    local league = frame.args[2]
    local delPoints=frame.args[3] or 0
    local pageId=frame.args['pageId'] or ' '
    local results = {}  
local hw, hd, hl, hgf, hga, aw, ad, al, agf, aga = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    local templateName = "Şablon:"..league.." maçları/maçlar"  
	local lastMatchDate={}
    local templatePage = mw.title.new(templateName)
    local content = templatePage:getContent()
	
	table.insert(results,"{{futbol ayrıntılı lig durumu")
	
	local pattern = "|(...)-(...)%s=%s\n{{Kapanabilir futbol maçı kutusu\n|tarih%s*=%s*([^\n]*)\n|zaman%s*=%s*([^|]*)\n|tur%s*=%s*(%d+)\n|takım1%s*=%s*([^\n]*)\n|sonuç%s*=%s*([^|]*)"
		for m1, m2, m3,m4,m5,m6,m7 in mw.ustring.gmatch(content,pattern) do

					if team==m1 or team==m2 then
							local pattern2 = "(%d+)%s*-%s*(%d+)"
						for num1, num2 in mw.ustring.gmatch(m7,pattern2) do
						lastMatchDate=m3	                
            			   if team == m1 then
                		  if num1>num2 then
                		hw=hw+1
            			   elseif num1<num2 then
            				hl=hl+1
            			   elseif num1==num2 then
        			  	hd=hd+1
            			   end
            			  hgf=hgf+num1
            			  hga=hga+num2
        		  	
            		  	
                		  
            			  elseif team == m2 then
            		     if num1>num2 then
                		al=al+1
            			   elseif num1<num2 then
            				aw=aw+1
            			   elseif num1==num2 then
        			  	ad=ad+1
            			   end
            			  aga=aga+num1
            			  agf=agf+num2
            			  end

						end
					end
				
				end
    	table.insert(results,"|eg="..hw.." |eb="..hd.." |em="..hl.." |eag="..hgf.." |eyg="..hga.." |dg="..aw.." |db="..ad.." |dm="..al.." |dag="..agf.." |dyg="..aga.." |sp="..delPoints.."}}")
    	table.insert(results,"\n{{Futbol ayrıntılı lig durumu altbilgisi |u= "..lastMatchDate.." |s=[http://www.tff.org/default.aspx?pageID="..pageId.." TFF Puan durumu ve fikstür] }}")
    	return mw.text.trim(frame:preprocess(table.concat(results)))
	end

function p.getTeamResults(frame)
    local team = frame.args[1]  
    local league = frame.args[2] 
    local count = frame.args[3]  
    local results = {}  
    local countMatch=0
    local templateName = "Şablon:"..league.." maçları/maçlar"  

    local templatePage = mw.title.new(templateName)
    local content = templatePage:getContent()

local pattern = "|(...)-(...)%s=%s\n{{Kapanabilir futbol maçı kutusu\n|tarih%s*=%s*([^\n]*)\n|zaman%s*=%s*([^|]*)\n|tur%s*=%s*(%d+)\n|takım1%s*=%s*([^\n]*)\n|sonuç%s*=%s*([^|]*)"


    for m1, m2, m3,m4,m5,m6,m7 in mw.ustring.gmatch(content,pattern) do
				if team==m1 or team==m2 then
							countMatch=countMatch+1

					local result
					if string.find(m7,"ERT") or m7=='' then
						result=" "
					end
					if string.find(m7,"Y") then
						result="Y"
					end
					local pattern2 = "(%d+)%s*-%s*(%d+)"
						for num1, num2 in mw.ustring.gmatch(m7,pattern2) do
							                
                if team == m1 then
                    result = (num1 > num2 and "G") or (num1 < num2 and "M") or "B"
                elseif team == m2 then
                    result = (num1 > num2 and "M") or (num1 < num2 and "G") or "B"
                end

						end
				 table.insert(results, result)
				if countMatch~=tonumber(count) then
					table.insert(results, "/ ")
					end

		end

    end
    return table.concat(results, " ")
end

return p