Module:EpisodeList

local episodelist = { ['Digimon Adventure'] = "01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50 51 - 52 - 53 - 54", ['Digimon Adventure 02'] = "01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50", ['Digimon Tamers'] = "01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50 51", ['Digimon Frontier'] = "01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50", ['Digimon Data Squad'] ="01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48", ['Digimon Fusion'] = "01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 Death Generals 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50 - 51 - 52 - 53 - 54 Young Hunters 55 - 56 - 57 - 58 - 59 - 60 - 61 - 62 - 63 - 64 - 65 - 66 - 67 - 68 - 69 - 70 - 71 - 72 - 73 - 74 - 75 - 76 - 77 - 78 - 79", ['Digimon Adventure tri.'] = "01 - 02 - 03 - 04", ['Digimon Universe: Appli Monsters'] = "01 - 02", }

local prev_series = { ['Digimon Adventure 02'] = {"And so it begins...", "Digimon Adventure"}, ['Digimon Tamers'] = {"Enter Flamedramon", "Digimon Adventure 02"}, ['Digimon Frontier'] = {"Guilmon Comes Alive", "Digimon Tamers"}, ['Digimon Data Squad'] = {"All Aboard", "Digimon Frontier"}, ['Digimon Fusion'] = {"THERE ARE MONSTERS AMONG US!", "Digimon Data Squad"}, ['Digimon Adventure tri.'] = {"Mikey Goes To Another World!", "Digimon Fusion"}, ['Digimon Universe: Appli Monsters'] = {"Reunion (Adventure tri.)", "Digimon Adventure tri."}, }

local next_series = { ['Digimon Adventure'] = {"Enter Flamedramon", "Digimon Adventure 02"}, ['Digimon Adventure 02'] = {"Guilmon Comes Alive", "Digimon Tamers"}, ['Digimon Tamers'] = {"All Aboard", "Digimon Frontier"}, ['Digimon Frontier'] = {"THERE ARE MONSTERS AMONG US!", "Digimon Data Squad"}, ['Digimon Data Squad'] = {"Mikey Goes To Another World!", "Digimon Fusion"}, ['Digimon Fusion'] = {"Reunion (Adventure tri.)", "Digimon Adventure tri."}, ['Digimon Adventure tri.'] = {"The Search Result is Haru Shinkai! Gatchmon Appears!", "Digimon Universe: Appli Monsters"}, }

local appendices_pre = { ['Digimon Adventure'] = "Digimon Adventure", ['Digimon Adventure 02'] = "Digimon Adventure 02", ['Digimon Tamers'] = 'Digimon Tamers', ['Digimon Frontier'] = 'Digimon Frontier', ['Digimon Data Squad'] = 'Digimon Data Squad', ['Digimon Fusion'] = 'Digimon Fusion', ['Digimon Adventure tri.'] = 'Digimon Adventure tri.', ['Digimon Universe: Appli Monsters'] = 'Digimon Universe: Appli Monsters', }

episode_table = { ['episodelist'] = episodelist, ['prev_series'] = next_series, ['next_series'] = next_series, ['appendices_pre'] = appendices_pre, }

-- Libraries of functions --

-- stands for High Frequency local HF = mw.InfoboxBuilderHF -- Parses invocation parameters, trims whitespace, and removes blanks. local getArgs = require('Dev:Arguments').getArgs -- Outputs various kinds of lists. local L = require('Dev:List') -- Gives the name of the current page. It's expensive, so we only do it once. -- The _G then makes it global, available to all page functions. _G.vars = { Pagename = mw.title.getCurrentTitle.text } -- -- Public functions (called from a Template or article) -- -- function episode_table.More(frame) local args = getArgs(frame) --if args.series ~= 'Movie' then return episode_table._moreEpisodes(args) --else --end

end

-- Internal functions (used in this and other Modules --

function episodelist:validseason( name ) if type( self[ name ] ) == 'string' then return true else return nil end end

function episodelist:makeList( name ) if self:validseason ( name ) then -- local episodes = mw.text.split( self[name], ' · ' ) -- return L.makeList( 'horizontal', episodes ) return self[name] else return nil end end

function appendices_pre:validseason( name ) if type( self[ name ] ) == 'string' then return true else return nil end end

function appendices_pre:subst( name, episode ) local appendix = {} local parts = { ['left'] = ,       ['right'] = , ['cast'] = '/Appendices/Cast/Episode ', ['analyzer'] = '/Appendices/Analyzer/Episode ', ['digivolutions'] = '/Appendices/Digivolutions/Episode ', ['attacks'] = '/Appendices/Attacks/Episode ', ['locations'] = '/Appendices/Locations/Episode ', }   if type(episode) == 'number' then episode = string.format('%02d', episode) else episode = episode end if self:validseason( name ) then table.insert( appendix,     parts['left']..      self[name]..parts['cast']..episode..'|Cast'..      parts['right']     ) if mw.title.new( self[name]..parts['analyzer']..episode ).exists == true then table.insert( appendix,      parts['left']..       self[name]..parts['analyzer']..episode..'|Analyzer'..       parts['right']      ) end if mw.title.new( self[name]..parts['digivolutions']..episode ).exists == true then table.insert( appendix,      parts['left']..       self[name]..parts['digivolutions']..episode..'|Digivolutions'..       parts['right']      ) end if mw.title.new( self[name]..parts['attacks']..episode ).exists == true then table.insert( appendix,      parts['left']..       self[name]..parts['attacks']..episode..'|Attacks'..       parts['right']      ) end if mw.title.new( self[name]..parts['locations']..episode ).exists == true then table.insert( appendix,      parts['left']..       self[name]..parts['locations']..episode..'|Locations'..       parts['right']      ) end return L.makeList( 'horizontal', appendix ) else return nil end end

function episode_table._moreEpisodes( field, vars ) local parts = { ['left'] = ,       ['right'] =  }   local output = ' '..parts['left']..'List of ' .. field.series .. ' episodes'..parts['right']..' ' output = output .. appendices:makeList( field.series ) output = output .. ' '   --style="background:transparent; text-align:left" |&laquo; Digimon Adventure if prev_series[ field.series ] then output = output .. ' ' ..       parts['left'] .. prev_series[ field.series ][1]..'|&laquo; '.. prev_series[ field.series ][2].. parts['right'].. ' '   end --| style="background:transparent; text-align:right" |Digimon Tamers &raquo; if next_series[ field.series ] then output = output .. ' ' ..       parts['left'] .. next_series[ field.series ][1]..'|'.. next_series[ field.series ][2]..' &raquo;'.. parts['right'].. ' '   end output = output .. ' '   return output end

function episode_table.Appendix( field, vars ) end

- -- Output (send it back to whatever called it) -- - return episode_table