Difference between revisions of "Module:Franchise total episodes"

From blackwiki
Jump to navigation Jump to search
blackwiki>TheTVExpert
m (TheTVExpert moved page Module:Franchise Total Episodes to Module:Franchise total episodes without leaving a redirect)
blackwiki>TheTVExpert
(Sync with Sandbox)
Line 32: Line 32:
 
return I1
 
return I1
 
end
 
end
 +
 +
local expand = function(frame,page,template,one,two,three)
 +
local result = (frame:expandTemplate{title='Template parameter value',args={page,template,one,two,three}})
 +
return result
 +
end
 +
 +
local getDateDFull = function(frame,value,i)
 +
 +
if(value ~= 'none none none none') then
 +
local number = (expand(frame,value,"Infobox television",1,"num_episodes",1)+i)
 +
value = expand(frame,value,"Episode list",number,"OriginalAirDate",1)
 +
end
 +
 +
value = string.gsub(value, ",", "")
 +
 +
local t = {}
 +
 +
for substring in value:gmatch("%w+") do
 +
table.insert(t,substring)
 +
end
 +
 +
return t
 +
end
 +
 +
local getDateDPart = function(num,t)
 +
local value
 +
if(num==1) then
 +
value = tonumber(monthNum(t[5]))
 +
if(value == nil) then value = 0 end
 +
end
 +
if(num==2) then
 +
value = tonumber(monthNum(t[1]))
 +
if(value == nil) then value = 0 end
 +
end
 +
if(num==3) then
 +
value = tonumber(monthNum(t[3]))
 +
if(value == nil) then value = 0 end
 +
end
 +
return value
 +
end
 +
 +
local getDateL = function(frame,num,L,T)
 +
local value
 +
if(num==1) then
 +
value = tonumber(expand(frame,L,T,1,1,1))
 +
if(value == nil) then value = 0 end
 +
end
 +
if(num==2) then
 +
value = tonumber(expand(frame,L,T,1,2,1))
 +
if(value == nil) then value = 0 end
 +
end
 +
if(num==3) then
 +
value = tonumber(expand(frame,L,T,1,3,1))
 +
if(value == nil) then value = 0 end
 +
end
 +
return value
 +
end
 +
 +
local getS = function(frame,S,T1,T2)
 +
local value = tonumber(expand(frame,S,T1,1,T2,1))
 +
if(value == nil) then value = 0 end
 +
return value
 +
end
  
 
p.main = function( frame )
 
p.main = function( frame )
Line 56: Line 119:
 
local D4I = mw.getCurrentFrame():getParent().args.D4I or frame.args.D4I or 0
 
local D4I = mw.getCurrentFrame():getParent().args.D4I or frame.args.D4I or 0
 
local D5I = mw.getCurrentFrame():getParent().args.D5I or frame.args.D5I or 0
 
local D5I = mw.getCurrentFrame():getParent().args.D5I or frame.args.D5I or 0
 
if(D1 ~= 'none none none none') then
 
local D1N = (frame:expandTemplate{title='Template parameter value',args={D1,"Infobox television",1,"num_episodes"}}+D1I)
 
D1 = frame:expandTemplate{title='Template parameter value',args={D1,"Episode list",D1N,"OriginalAirDate",1}}
 
end
 
if(D2 ~= 'none none none none') then
 
local D2N = (frame:expandTemplate{title='Template parameter value',args={D2,"Infobox television",1,"num_episodes"}}+D2I)
 
D2 = frame:expandTemplate{title='Template parameter value',args={D2,"Episode list",D2N,"OriginalAirDate",1}}
 
end
 
if(D3 ~= 'none none none none') then
 
local D3N = (frame:expandTemplate{title='Template parameter value',args={D3,"Infobox television",1,"num_episodes"}}+D3I)
 
D3 = frame:expandTemplate{title='Template parameter value',args={D3,"Episode list",D3N,"OriginalAirDate",1}}
 
end
 
if(D4 ~= 'none none none none') then
 
local D4N = (frame:expandTemplate{title='Template parameter value',args={D4,"Infobox television",1,"num_episodes"}}+D4I)
 
D4 = frame:expandTemplate{title='Template parameter value',args={D4,"Episode list",D4N,"OriginalAirDate",1}}
 
end
 
if(D5 ~= 'none none none none') then
 
local D5N = (frame:expandTemplate{title='Template parameter value',args={D5,"Infobox television",1,"num_episodes"}}+D5I)
 
D5 = frame:expandTemplate{title='Template parameter value',args={D5,"Episode list",D5N,"OriginalAirDate",1}}
 
end
 
 
D1 = string.gsub(D1, ",", "")
 
D2 = string.gsub(D2, ",", "")
 
D3 = string.gsub(D3, ",", "")
 
D4 = string.gsub(D4, ",", "")
 
D5 = string.gsub(D5, ",", "")
 
 
local D1t = {}
 
local D2t = {}
 
local D3t = {}
 
local D4t = {}
 
local D5t = {}
 
 
for substring in D1:gmatch("%w+") do
 
table.insert(D1t,substring)
 
end
 
 
for substring in D2:gmatch("%w+") do
 
table.insert(D2t,substring)
 
end
 
 
for substring in D3:gmatch("%w+") do
 
table.insert(D3t,substring)
 
end
 
 
for substring in D4:gmatch("%w+") do
 
table.insert(D4t,substring)
 
end
 
 
for substring in D5:gmatch("%w+") do
 
table.insert(D5t,substring)
 
end
 
 
 
 
local L1 = mw.getCurrentFrame():getParent().args.L1 or frame.args.L1
 
local L1 = mw.getCurrentFrame():getParent().args.L1 or frame.args.L1
Line 115: Line 125:
 
local L4 = mw.getCurrentFrame():getParent().args.L4 or frame.args.L4
 
local L4 = mw.getCurrentFrame():getParent().args.L4 or frame.args.L4
 
local L5 = mw.getCurrentFrame():getParent().args.L5 or frame.args.L5
 
local L5 = mw.getCurrentFrame():getParent().args.L5 or frame.args.L5
local T1 = mw.getCurrentFrame():getParent().args.T1 or 'Aired episodes'
+
local T1 = 'Aired episodes'
 
local T2 = 'Infobox television'
 
local T2 = 'Infobox television'
 
local T3 = 'num_episodes'
 
local T3 = 'num_episodes'
Line 133: Line 143:
 
local Date = mw.getCurrentFrame():getParent().args.Date or frame.args.Date
 
local Date = mw.getCurrentFrame():getParent().args.Date or frame.args.Date
 
local sum = mw.getCurrentFrame():getParent().args.sum or frame.args.sum
 
local sum = mw.getCurrentFrame():getParent().args.sum or frame.args.sum
 +
 +
local D1t = getDateDFull(frame,D1,D1I)
 +
local D2t = getDateDFull(frame,D2,D2I)
 +
local D3t = getDateDFull(frame,D3,D3I)
 +
local D4t = getDateDFull(frame,D4,D4I)
 +
local D5t = getDateDFull(frame,D5,D5I)
  
local L1_1 = tonumber(frame:expandTemplate{title='Template parameter value',args={L1,T1,1,1,1}})
+
local L1_1 = getDateL(frame,1,L1,T1)
if(L1_1 == nil) then L1_1 = 0 end
+
local L1_2 = getDateL(frame,2,L1,T1)
local L1_2 = tonumber(frame:expandTemplate{title='Template parameter value',args={L1,T1,1,2,1}})
+
local L1_3 = getDateL(frame,3,L1,T1)
if(L1_2 == nil) then L1_2 = 0 end
 
local L1_3 = tonumber(frame:expandTemplate{title='Template parameter value',args={L1,T1,1,3,1}})
 
if(L1_3 == nil) then L1_3 = 0 end
 
 
 
local L2_1 = tonumber(frame:expandTemplate{title='Template parameter value',args={L2,T1,1,1,1}})
+
local L2_1 = getDateL(frame,1,L2,T1)
if(L2_1 == nil) then L2_1 = 0 end
+
local L2_2 = getDateL(frame,2,L2,T1)
local L2_2 = tonumber(frame:expandTemplate{title='Template parameter value',args={L2,T1,1,2,1}})
+
local L2_3 = getDateL(frame,3,L2,T1)
if(L2_2 == nil) then L2_2 = 0 end
 
local L2_3 = tonumber(frame:expandTemplate{title='Template parameter value',args={L2,T1,1,3,1}})
 
if(L2_3 == nil) then L2_3 = 0 end
 
 
 
local L3_1 = tonumber(frame:expandTemplate{title='Template parameter value',args={L3,T1,1,1,1}})
+
local L3_1 = getDateL(frame,1,L3,T1)
if(L3_1 == nil) then L3_1 = 0 end
+
local L3_2 = getDateL(frame,2,L3,T1)
local L3_2 = tonumber(frame:expandTemplate{title='Template parameter value',args={L3,T1,1,2,1}})
+
local L3_3 = getDateL(frame,3,L3,T1)
if(L3_2 == nil) then L3_2 = 0 end
 
local L3_3 = tonumber(frame:expandTemplate{title='Template parameter value',args={L3,T1,1,3,1}})
 
if(L3_3 == nil) then L3_3 = 0 end
 
 
 
local L4_1 = tonumber(frame:expandTemplate{title='Template parameter value',args={L4,T1,1,1,1}})
+
local L4_1 = getDateL(frame,1,L4,T1)
if(L4_1 == nil) then L4_1 = 0 end
+
local L4_2 = getDateL(frame,2,L4,T1)
local L4_2 = tonumber(frame:expandTemplate{title='Template parameter value',args={L4,T1,1,2,1}})
+
local L4_3 = getDateL(frame,3,L4,T1)
if(L4_2 == nil) then L4_2 = 0 end
 
local L4_3 = tonumber(frame:expandTemplate{title='Template parameter value',args={L4,T1,1,3,1}})
 
if(L4_3 == nil) then L4_3 = 0 end
 
 
 
local L5_1 = tonumber(frame:expandTemplate{title='Template parameter value',args={L5,T1,1,1,1}})
+
local L5_1 = getDateL(frame,1,L5,T1)
if(L5_1 == nil) then L5_1 = 0 end
+
local L5_2 = getDateL(frame,2,L5,T1)
local L5_2 = tonumber(frame:expandTemplate{title='Template parameter value',args={L5,T1,1,2,1}})
+
local L5_3 = getDateL(frame,3,L5,T1)
if(L5_2 == nil) then L5_2 = 0 end
 
local L5_3 = tonumber(frame:expandTemplate{title='Template parameter value',args={L5,T1,1,3,1}})
 
if(L5_3 == nil) then L5_3 = 0 end
 
 
 
 
 
local D1Y = tonumber(monthNum(D1t[5]))
+
local D1Y = getDateDPart(1,D1t)
if(D1Y == nil) then D1Y = 0 end
+
local D1M = getDateDPart(2,D1t)
local D1M = tonumber(monthNum(D1t[1]))
+
local D1D = getDateDPart(3,D1t)
if(D1M == nil) then D1M = 0 end
 
local D1D = tonumber(monthNum(D1t[3]))
 
if(D1D == nil) then D1D = 0 end
 
 
 
local D2Y = tonumber(monthNum(D2t[5]))
+
local D2Y = getDateDPart(1,D2t)
if(D2Y == nil) then D2Y = 0 end
+
local D2M = getDateDPart(2,D2t)
local D2M = tonumber(monthNum(D2t[1]))
+
local D2D = getDateDPart(3,D2t)
if(D2M == nil) then D2M = 0 end
 
local D2D = tonumber(monthNum(D2t[3]))
 
if(D2D == nil) then D2D = 0 end
 
 
 
local D3Y = tonumber(monthNum(D3t[5]))
+
local D3Y = getDateDPart(1,D3t)
if(D3Y == nil) then D3Y = 0 end
+
local D3M = getDateDPart(2,D3t)
local D3M = tonumber(monthNum(D3t[1]))
+
local D3D = getDateDPart(3,D3t)
if(D3M == nil) then D3M = 0 end
 
local D3D = tonumber(monthNum(D3t[3]))
 
if(D3D == nil) then D3D = 0 end
 
 
 
local D4Y = tonumber(monthNum(D4t[5]))
+
local D4Y = getDateDPart(1,D4t)
if(D4Y == nil) then D4Y = 0 end
+
local D4M = getDateDPart(2,D4t)
local D4M = tonumber(monthNum(D4t[1]))
+
local D4D = getDateDPart(3,D4t)
if(D4M == nil) then D4M = 0 end
 
local D4D = tonumber(monthNum(D4t[3]))
 
if(D4D == nil) then D4D = 0 end
 
 
 
local D5Y = tonumber(monthNum(D5t[5]))
+
local D5Y = getDateDPart(1,D5t)
if(D5Y == nil) then D5Y = 0 end
+
local D5M = getDateDPart(2,D5t)
local D5M = tonumber(monthNum(D5t[1]))
+
local D5D = getDateDPart(3,D5t)
if(D5M == nil) then D5M = 0 end
 
local D5D = tonumber(monthNum(D5t[3]))
 
if(D5D == nil) then D5D = 0 end
 
 
 
 
local year, month, day
 
local year, month, day
 +
local month1=0
 +
local month2=0
 +
local month3=0
 +
local month4=0
 +
local month5=0
 +
local month1D=0
 +
local month2D=0
 +
local month3D=0
 +
local month4D=0
 +
local month5D=0
 
local day1=0
 
local day1=0
 
local day2=0
 
local day2=0
Line 218: Line 214:
  
 
year = math.max(L1_1,L2_1,L3_1,L4_1,L5_1,D1Y,D2Y,D3Y,D4Y,D5Y)
 
year = math.max(L1_1,L2_1,L3_1,L4_1,L5_1,D1Y,D2Y,D3Y,D4Y,D5Y)
month = monthName(math.max(L1_2,L2_2,L3_2,L4_2,L5_2,D1M,D2M,D3M,D4M,D5M))
+
 +
if(year == L1_1) then month1=L1_2 end
 +
if(year == L2_1) then month2=L2_2 end
 +
if(year == L3_1) then month3=L3_2 end
 +
if(year == L4_1) then month4=L4_2 end
 +
if(year == L5_1) then month5=L5_2 end
 +
if(year == D1Y) then month1D=D1M end
 +
if(year == D2Y) then month2D=D2M end
 +
if(year == D3Y) then month3D=D3M end
 +
if(year == D4Y) then month4D=D4M end
 +
if(year == D5Y) then month5D=D5M end
 +
 +
month = monthName(math.max(month1,month2,month3,month4,month5,month1D,month2D,month3D,month4D,month5D))
 
 
 
if(monthNum(month) == L1_2) then day1=L1_3 end
 
if(monthNum(month) == L1_2) then day1=L1_3 end
Line 233: Line 241:
 
day = math.max(day1,day2,day3,day4,day5,day1D,day2D,day3D,day4D,day5D)
 
day = math.max(day1,day2,day3,day4,day5,day1D,day2D,day3D,day4D,day5D)
 
 
local S1 = tonumber(frame:expandTemplate{title='Template parameter value',args={S1,T2,1,T3,1}})
+
local S1 = getS(frame,S1,T2,T3)
if(S1 == nil) then S1 = 0 end
+
local S2 = getS(frame,S2,T2,T3)
local S2 = tonumber(frame:expandTemplate{title='Template parameter value',args={S2,T2,1,T3,1}})
+
local S3 = getS(frame,S3,T2,T3)
if(S2 == nil) then S2 = 0 end
+
local S4 = getS(frame,S4,T2,T3)
local S3 = tonumber(frame:expandTemplate{title='Template parameter value',args={S3,T2,1,T3,1}})
+
local S5 = getS(frame,S5,T2,T3)
if(S3 == nil) then S3 = 0 end
+
local S6 = getS(frame,S6,T2,T3)
local S4 = tonumber(frame:expandTemplate{title='Template parameter value',args={S4,T2,1,T3,1}})
+
local S7 = getS(frame,S7,T2,T3)
if(S4 == nil) then S4 = 0 end
+
local S8 = getS(frame,S8,T2,T3)
local S5 = tonumber(frame:expandTemplate{title='Template parameter value',args={S5,T2,1,T3,1}})
+
local S9 = getS(frame,S9,T2,T3)
if(S5 == nil) then S5 = 0 end
+
local S10 = getS(frame,S10,T2,T3)
local S6 = tonumber(frame:expandTemplate{title='Template parameter value',args={S6,T2,1,T3,1}})
 
if(S6 == nil) then S6 = 0 end
 
local S7 = tonumber(frame:expandTemplate{title='Template parameter value',args={S7,T2,1,T3,1}})
 
if(S7 == nil) then S7 = 0 end
 
local S8 = tonumber(frame:expandTemplate{title='Template parameter value',args={S8,T2,1,T3,1}})
 
if(S8 == nil) then S8 = 0 end
 
local S9 = tonumber(frame:expandTemplate{title='Template parameter value',args={S9,T2,1,T3,1}})
 
if(S9 == nil) then S9 = 0 end
 
local S10 = tonumber(frame:expandTemplate{title='Template parameter value',args={S10,T2,1,T3,1}})
 
if(S10 == nil) then S10 = 0 end
 
  
 
if(year == nil) then year = "year" end
 
if(year == nil) then year = "year" end

Revision as of 16:00, 10 June 2020

Implements {{Franchise total episodes}}


local p = {};

local monthName = function(I1)
	if(I1 == 1) then return 'January' end
	if(I1 == 2) then return 'February' end
	if(I1 == 3) then return 'March' end
	if(I1 == 4) then return 'April' end
	if(I1 == 5) then return 'May' end
	if(I1 == 6) then return 'June' end
	if(I1 == 7) then return 'July' end
	if(I1 == 8) then return 'August' end
	if(I1 == 9) then return 'September' end
	if(I1 == 10) then return 'October' end
	if(I1 == 11) then return 'November' end
	if(I1 == 12) then return 'December' end
	if(I1 == 0) then return 0 end
	end
	
local monthNum = function(I1)
	if(I1 == 'January') then return 1 end
	if(I1 == 'February') then return 2 end
	if(I1 == 'March') then return 3 end
	if(I1 == 'April') then return 4 end
	if(I1 == 'May') then return 5 end
	if(I1 == 'June') then return 6 end
	if(I1 == 'July') then return 7 end
	if(I1 == 'August') then return 8 end
	if(I1 == 'September') then return 9 end
	if(I1 == 'October') then return 10 end
	if(I1 == 'November') then return 11 end
	if(I1 == 'December') then return 12 end
	return I1
	end

local expand = function(frame,page,template,one,two,three)
	local result = (frame:expandTemplate{title='Template parameter value',args={page,template,one,two,three}})
	return result
end

local getDateDFull = function(frame,value,i)

	if(value ~= 'none none none none') then
		local number = (expand(frame,value,"Infobox television",1,"num_episodes",1)+i)
		value = expand(frame,value,"Episode list",number,"OriginalAirDate",1)
	end

	value = string.gsub(value, ",", "")
	
	local t = {}
	
	for substring in value:gmatch("%w+") do
		table.insert(t,substring)
	end
	
	return t
end

local getDateDPart = function(num,t)
	local value
	if(num==1) then
		value = tonumber(monthNum(t[5]))
		if(value == nil) then value = 0 end
	end
	if(num==2) then
		value = tonumber(monthNum(t[1]))
		if(value == nil) then value = 0 end
	end
	if(num==3) then
		value = tonumber(monthNum(t[3]))
		if(value == nil) then value = 0 end
	end
	return value
end

local getDateL = function(frame,num,L,T)
	local value
	if(num==1) then
		value = tonumber(expand(frame,L,T,1,1,1))
		if(value == nil) then value = 0 end
	end
	if(num==2) then
		value = tonumber(expand(frame,L,T,1,2,1))
		if(value == nil) then value = 0 end
	end
	if(num==3) then
		value = tonumber(expand(frame,L,T,1,3,1))
		if(value == nil) then value = 0 end
	end
	return value
end

local getS = function(frame,S,T1,T2)
	local value = tonumber(expand(frame,S,T1,1,T2,1))
	if(value == nil) then value = 0 end	
	return value
end

p.main = function( frame )
	
	local D1 = mw.getCurrentFrame():getParent().args.D1 or frame.args.D1
	if(D1 == nil) then D1 = "none none none none" end
	D1 = tostring(D1)
	local D2 = mw.getCurrentFrame():getParent().args.D2 or frame.args.D2
	if(D2 == nil) then D2 = "none none none none" end
	D2 = tostring(D2)
	local D3 = mw.getCurrentFrame():getParent().args.D3 or frame.args.D3
	if(D3 == nil) then D3 = "none none none none" end
	D3 = tostring(D3)
	local D4 = mw.getCurrentFrame():getParent().args.D4 or frame.args.D4
	if(D4 == nil) then D4 = "none none none none" end
	D4 = tostring(D4)
	local D5 = mw.getCurrentFrame():getParent().args.D5 or frame.args.D5
	if(D5 == nil) then D5 = "none none none none" end
	D5 = tostring(D5)
	
	local D1I = mw.getCurrentFrame():getParent().args.D1I or frame.args.D1I or 0
	local D2I = mw.getCurrentFrame():getParent().args.D2I or frame.args.D2I or 0
	local D3I = mw.getCurrentFrame():getParent().args.D3I or frame.args.D3I or 0
	local D4I = mw.getCurrentFrame():getParent().args.D4I or frame.args.D4I or 0
	local D5I = mw.getCurrentFrame():getParent().args.D5I or frame.args.D5I or 0
	
	local L1 = mw.getCurrentFrame():getParent().args.L1 or frame.args.L1
	local L2 = mw.getCurrentFrame():getParent().args.L2 or frame.args.L2
	local L3 = mw.getCurrentFrame():getParent().args.L3 or frame.args.L3
	local L4 = mw.getCurrentFrame():getParent().args.L4 or frame.args.L4
	local L5 = mw.getCurrentFrame():getParent().args.L5 or frame.args.L5
	local T1 = 'Aired episodes'
	local T2 = 'Infobox television'
	local T3 = 'num_episodes'
	local S1 = mw.getCurrentFrame():getParent().args.S1 or frame.args.S1
	local S2 = mw.getCurrentFrame():getParent().args.S2 or frame.args.S2
	local S3 = mw.getCurrentFrame():getParent().args.S3 or frame.args.S3
	local S4 = mw.getCurrentFrame():getParent().args.S4 or frame.args.S4
	local S5 = mw.getCurrentFrame():getParent().args.S5 or frame.args.S5
	local S6 = mw.getCurrentFrame():getParent().args.S6 or frame.args.S6
	local S7 = mw.getCurrentFrame():getParent().args.S7 or frame.args.S7
	local S8 = mw.getCurrentFrame():getParent().args.S8 or frame.args.S8
	local S9 = mw.getCurrentFrame():getParent().args.S9 or frame.args.S9
	local S10 = mw.getCurrentFrame():getParent().args.S10 or frame.args.S10
	local name = mw.getCurrentFrame():getParent().args.name  or frame.args.name
	name = tostring(name)
	if(name == 'nil') then name = "name" end
	local Date = mw.getCurrentFrame():getParent().args.Date or frame.args.Date
	local sum = mw.getCurrentFrame():getParent().args.sum or frame.args.sum
	
	local D1t = getDateDFull(frame,D1,D1I)
	local D2t = getDateDFull(frame,D2,D2I)
	local D3t = getDateDFull(frame,D3,D3I)
	local D4t = getDateDFull(frame,D4,D4I)
	local D5t = getDateDFull(frame,D5,D5I)

	local L1_1 = getDateL(frame,1,L1,T1)
	local L1_2 = getDateL(frame,2,L1,T1)
	local L1_3 = getDateL(frame,3,L1,T1)
	
	local L2_1 = getDateL(frame,1,L2,T1)
	local L2_2 = getDateL(frame,2,L2,T1)
	local L2_3 = getDateL(frame,3,L2,T1)
	
	local L3_1 = getDateL(frame,1,L3,T1)
	local L3_2 = getDateL(frame,2,L3,T1)
	local L3_3 = getDateL(frame,3,L3,T1)
	
	local L4_1 = getDateL(frame,1,L4,T1)
	local L4_2 = getDateL(frame,2,L4,T1)
	local L4_3 = getDateL(frame,3,L4,T1)
	
	local L5_1 = getDateL(frame,1,L5,T1)
	local L5_2 = getDateL(frame,2,L5,T1)
	local L5_3 = getDateL(frame,3,L5,T1)
	
	
	local D1Y = getDateDPart(1,D1t)
	local D1M = getDateDPart(2,D1t)
	local D1D = getDateDPart(3,D1t)
	
	local D2Y = getDateDPart(1,D2t)
	local D2M = getDateDPart(2,D2t)
	local D2D = getDateDPart(3,D2t)
	
	local D3Y = getDateDPart(1,D3t)
	local D3M = getDateDPart(2,D3t)
	local D3D = getDateDPart(3,D3t)
	
	local D4Y = getDateDPart(1,D4t)
	local D4M = getDateDPart(2,D4t)
	local D4D = getDateDPart(3,D4t)
	
	local D5Y = getDateDPart(1,D5t)
	local D5M = getDateDPart(2,D5t)
	local D5D = getDateDPart(3,D5t)
	
	local year, month, day
	local month1=0
	local month2=0
	local month3=0
	local month4=0
	local month5=0
	local month1D=0
	local month2D=0
	local month3D=0
	local month4D=0
	local month5D=0
	local day1=0
	local day2=0
	local day3=0
	local day4=0
	local day5=0
	local day1D=0
	local day2D=0
	local day3D=0
	local day4D=0
	local day5D=0

	year = math.max(L1_1,L2_1,L3_1,L4_1,L5_1,D1Y,D2Y,D3Y,D4Y,D5Y)
	
	if(year == L1_1) then month1=L1_2 end
	if(year == L2_1) then month2=L2_2 end
	if(year == L3_1) then month3=L3_2 end
	if(year == L4_1) then month4=L4_2 end
	if(year == L5_1) then month5=L5_2 end
	if(year == D1Y) then month1D=D1M end
	if(year == D2Y) then month2D=D2M end
	if(year == D3Y) then month3D=D3M end
	if(year == D4Y) then month4D=D4M end
	if(year == D5Y) then month5D=D5M end
	
	month = monthName(math.max(month1,month2,month3,month4,month5,month1D,month2D,month3D,month4D,month5D))
	
	if(monthNum(month) == L1_2) then day1=L1_3 end
	if(monthNum(month) == L2_2) then day2=L2_3 end
	if(monthNum(month) == L3_2) then day3=L3_3 end
	if(monthNum(month) == L4_2) then day4=L4_3 end
	if(monthNum(month) == L5_2) then day5=L5_3 end
	if(monthNum(month) == D1M) then day1D=D1D end
	if(monthNum(month) == D2M) then day2D=D2D end
	if(monthNum(month) == D3M) then day3D=D3D end
	if(monthNum(month) == D4M) then day4D=D4D end
	if(monthNum(month) == D5M) then day5D=D5D end
	
	day = math.max(day1,day2,day3,day4,day5,day1D,day2D,day3D,day4D,day5D)
	
	local S1 = getS(frame,S1,T2,T3)
	local S2 = getS(frame,S2,T2,T3)
	local S3 = getS(frame,S3,T2,T3)
	local S4 = getS(frame,S4,T2,T3)
	local S5 = getS(frame,S5,T2,T3)
	local S6 = getS(frame,S6,T2,T3)
	local S7 = getS(frame,S7,T2,T3)
	local S8 = getS(frame,S8,T2,T3)
	local S9 = getS(frame,S9,T2,T3)
	local S10 = getS(frame,S10,T2,T3)

	if(year == nil) then year = "year" end
	if(month == nil) then month = "month" end
	if(day == nil) then day = "day" end
	
	if(Date == nil) then Date = month .. " " .. day .. ", " .. year end
	
	if(sum == nil) then sum = (mw.getContentLanguage():formatNum(S1+S2+S3+S4+S5+S6+S7+S8+S9+S10)) end
	
	return "As of " .. Date .. ", " .. sum .. " episodes of the ''" .. name .. "'' franchise have aired."
end

return p