Module:Aired episodes explained

local spellnum = require('Module:Spellnum per MOS').spellnum

function oneEpisode(value, one_return, more_return) return (tonumber(value)

1 and one_return or more_return)end

function parseNumber(value) return tonumber(string.gsub(value, '^([%d]*).*', '%1'), 10)end

function ordinalNumber(frame, value) return frame:expandTemplateend

local p =

function p.main(frame) local args = require('Module:Arguments').getArgs(frame,) args = args or local airedEpisodes = local numberEpisodes = args.num or frame:expandTemplate numberEpisodes = parseNumber(numberEpisodes:gsub(",", )) local showName = (args.showpage and frame:expandTemplate or args.title):gsub("", ) local isAllFinished = (args.finished

'all') if isAllFinished then airedEpisodes = airedEpisodes .. 'During the course of the ' .. (args.uk and 'programme' or 'series') .. ',' else if args.date then airedEpisodes = airedEpisodes .. 'As of' .. args.date .. ',' else airedEpisodes = airedEpisodes .. frame:expandTemplate end end airedEpisodes = airedEpisodes .. ' ' .. spellnum .. ' episode' .. oneEpisode(numberEpisodes, , 's') .. " of " .. showName .. "" if not isAllFinished then airedEpisodes = airedEpisodes .. ' ' .. oneEpisode(numberEpisodes, 'has', 'have') end airedEpisodes = airedEpisodes .. ' ' .. (args.released and ((isAllFinished and 'were' or 'been') .. ' released') or 'aired') if args.specials then airedEpisodes = airedEpisodes .. ', including ' .. spellnum .. ' special' .. oneEpisode(args.specials, , 's') end if args.finished then if isAllFinished then if args.seasons then airedEpisodes = airedEpisodes .. ' over ' .. spellnum .. ' ' .. (args.uk and 'series' or ((args.part and 'part' or 'season') .. oneEpisode(args.seasons, , 's'))) end if args[1] then if args[4] then airedEpisodes = airedEpisodes .. ', between ' .. frame:expandTemplate .. ((args.uk or args.df) and or ',') .. ' and ' .. frame:expandTemplate else airedEpisodes = airedEpisodes .. ', concluding on ' .. frame:expandTemplate end end else local concludedPart = (args.finished_half and 'first half of the ' or (args.finished_part and ordinalNumber(frame, args.finished_part) .. ' part of the ' or )) airedEpisodes = airedEpisodes .. ', concluding the ' .. concludedPart .. ordinalNumber(frame, args.finished) .. ' ' .. (args.part and 'part' or args.uk and 'series' or 'season') end elseif args.airing then airedEpisodes = airedEpisodes .. ', currently in its ' .. ordinalNumber(frame, args.airing) .. ' ' .. (args.part and 'part' or args.uk and 'series' or 'season') end airedEpisodes = airedEpisodes .. '.' local title = mw.title.getCurrentTitle if title.namespace

0 then if args.showpage

args.title then airedEpisodes = airedEpisodes .. '' end if args.showpage and args.title then airedEpisodes = airedEpisodes .. '' end end return airedEpisodesend

return p