imported>Gonnym
No edit summary
 
(No difference)

Latest revision as of 20:04, 15 February 2020

Documentation for this module may be created at Module:Sandbox/Gonnym/sometest3/doc

local p = {}

local function addRow()
	local row = root:tag('tr')
	if (rowArgs.label) then
		row
			:tag('th')
			:attr('scope', 'row')
			:wikitext(rowArgs.label)
			:done()
	end
        
	local dataCell = row:tag('td')
	dataCell:wikitext(rowArgs.data, 'td')
end

local list = require('Module:List')

-- Very rough initial code.
function p.main(frame)
	
	-- Standard programs.
	if (network) then
		local network = args.network
		local firstAired
		local lastAired
		if (args.releaed) then
			firstAired = args.releaed
		else
			firstAired = args.first_aired
			lastAired =	args.last_aired
		end
	end
			
	-- Co productions. A TV show that can air in different countries but both count as an original production and should be listed in the infobox.
	if (args.co_network1) then
		local label = "Original networks"
		local networks = {}
		local firstAiredDates = {}
		local lastAiredDates = {}
		
		for i = 1, 4 do
			table.insert(networks, args["co_network" .. i])
			
			-- When the networks have different start or released dates (used for streaming)
			if (args.released_network1) then
				table.insert(firstAiredDates, args["released_network" .. i])
				
			-- When the networks have different start or finish airing dates (used for broastcast television).
			elseif (args.first_aired_network1) then
				table.insert(firstAiredDates, args["first_aired_network" .. i])
				table.insert(lastAiredDates, args["last_aired_network" .. i])
				
			-- When the networks have the same dates.
			else
				table.insert(firstAiredDates, args.first_aired)
				table.insert(lastAiredDates, args.last_aired)	
			end
		end

		list.makeList("unbulleted", networks)
	end
	
	-- This is used when a show switched channels.
	if (args.network1) then	
		local label = "Original networks"
		local networks = {}
		local firstAiredDates = {}
		local lastAiredDates = {}
		
		for i = 1, 10 do
			table.insert(networks, args["network" .. i])
			
			-- When the networks have different start or released dates (used for streaming)
			if (args.released_network1) then
				table.insert(firstAiredDates, args["released_network" .. i])
				
			-- When the networks have different start or finish airing dates (used for broastcast television).
			elseif (args.first_aired_network1) then
				table.insert(firstAiredDates, args["first_aired_network" .. i])
				table.insert(lastAiredDates, args["last_aired_network" .. i])
			end
		end

		list.makeList("unbulleted", networks)
	end
	
	if (first_aired1) then
		local network = args.network
		local firstAiredDates = {}
		local lastAiredDates = {}
		
		for i = 1, 10 do
			table.insert(firstAiredDates, args["first_aired" .. i])
			table.insert(lastAiredDates, args["last_aired" .. i])
		end
	end

	return
end

return p