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.'] = {"Search Result: Shinkai Haru! Gatchmon Appears!", "Digimon Universe: Appli Monsters"}, }

episode = { ['episodelist'] = episodelist, ['prev_series'] = prev_series, ['next_series'] = next_series, }

-- 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.More(frame) local args = getArgs(frame) return episode._moreEpisodes(args) 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 episode._moreEpisodes( args ) local parts = { ['left'] = ,       ['right'] =  }   local output = ' '..parts['left'].. 'List of ' .. args.series .. ' episodes'.. parts['right']..' ' output = output .. episodelist:makeList( args.series ) output = output .. ' '   if prev_series[ args.series ] then output = output .. ' ' ..       parts['left'] .. prev_series[ args.series ][1]..'|« '.. prev_series[ args.series ][2].. parts['right'].. ' '   end if next_series[ args.series ] then output = output .. ' ' ..       parts['left'] .. next_series[ args.series ][1]..'|'.. next_series[ args.series ][2]..' »'.. parts['right'].. ' '   end output = output .. ' '   return output end

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