Module:CX Zoom Beta/LearnSplit

From Wikipedia, the free encyclopedia
WikiProject Computer science / Computing  (Rated B-class, Mid-importance)
WikiProject iconThis module is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
B This module does not require a rating on the project's quality scale.
 Mid  This module has been rated as Mid-importance on the project's importance scale.
Taskforce icon
This module is supported by WikiProject Computing.
 
Things you can help WikiProject Computer science with:

WikiProject Computer science / Computing  (Rated B-class, Mid-importance)
WikiProject iconThis module is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
B This module does not require a rating on the project's quality scale.
 Mid  This module has been rated as Mid-importance on the project's importance scale.
Taskforce icon
This module is supported by WikiProject Computing.
 
Things you can help WikiProject Computer science with:


@@@WikiProject Computer science &&& small===000 &&& category===000 &&& listas===000 &&& auto===000 &&& importance===Mid &&& attention===000 &&& needs-infobox===000 &&& needs-image===000 &&& computing===yes &&& computing-importance===000 &&& class===GA &&&###

WikiProject Computer science / Computing  (Rated GA-class, Mid-importance)
WikiProject iconThis module is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 GA This module does not require a rating on the project's quality scale.
 Mid  This module has been rated as Mid-importance on the project's importance scale.
Taskforce icon
This module is supported by WikiProject Computing.
 
Things you can help WikiProject Computer science with:


local A = {}

function A.main( frame )
	local content = frame.args[1]
	local class = frame.args["class"]
	
	local temps = {}
	local name = {}
	local i = 1
	
	local params = {}
	local params_x = {}
	local params_y = {}
	local Y = {}
	local oldClass = {}
	
	for t in string.gmatch(content, "(.-)###") do
		temps[i] = mw.text.trim(t)
		
		params[i] = {}
		params_x[i] = {}
		params_y[i] = {}
		Y[i] = {}
		local j = 0
		
		for p in string.gmatch(temps[i], "([^&&&]-)&&&") do
			params[i][j] = mw.text.trim(p)
			
			if j ~= 0 then
				params_x[i][j], params_y[i][j] = string.match(params[i][j], "(.*)===(.*)")
				if params_y[i][j] ~= "000" then
					Y[i][params_x[i][j]] = params_y[i][j]
				end
			end
			
			j = j + 1
		end
		
		if Y[i]["class"] ~= nil then
			oldClass[i] = Y[i]["class"]
		end
		
		if class ~= nil then
			Y[i]["class"] = class
		end
		
		m, n = string.match(params[i][0], "(.*)@@@(.*)")
			name[i] = mw.text.trim(n)
		
		if i == 1 then
			store = frame:expandTemplate{ title = name[i], args = Y[i] }
		else
			store = store .. frame:expandTemplate{ title = name[i], args = Y[i] }
		end
		
		i = i + 1
	end
	
	for k, v in pairs( oldClass ) do
		if v ~= nil then
			oldClassCat = "[[Category:Pages using WikiProject banners with internal class parameters]]"
			break
		else
			oldClassCat = ""
		end
	end
	
	local c = i
	while c > 2 do
		if oldClass[c-1] ~= oldClass[c-2] then
			oldClassCat = oldClassCat .. "[[Category:Pages using WikiProject banners with mismatching class parameters]]"
			c = 0
		else
			oldClassCat = oldClassCat .. ""
			c = c - 1
		end
	end
	
	if class == nil then
		oldClassCat = oldClassCat .. "[[Category:Pages using WikiProject banner shell without class parameter]]"
	else
		local d = i
		while d > 1 do
			if oldClass[d-1] ~= class then
				oldClassCat = oldClassCat .. "[[Category:Pages using WikiProject banner shell with class parameter distinct from internal banners]]"
				d = 0
			else
				oldClassCat = oldClassCat .. ""
				d = d - 1
			end
		end
	end
	
	local output = store .. oldClassCat
	
	return output
end

return A