Kubera Wiki
Advertisement

Documentation for this module may be created at Module:ReferenceCode/doc

--
-- Module:ReferenceCode
--
-- The purpose of this module is to simplify reference links.
-- 
-- Create a reference link using this format: {{ref|season|episode}}
--    e.g. {{ref|1|24}} or {{ref|2|110}}
--    For multiple citatations of the same source, use {{ref|1|24|}} (blank 3rd argument)
--        for citation -after- the first one.
--    Template:Ref will call this module.
-- 
-- 
 
local p = {}
 
function p.GetReference( frame )
	local args = frame:getParent().args
	local season = args[1]
	local episode = args[2]
	local refid = 'Error with reference: season number'
	local title = 'Error with reference: chapter number'
	-- line 20
 
	episode = tonumber( episode )
	-- This could probably be done more efficiently with a multidimensional array,
	-- but I just want to get this running for now.
	if (season == '1') then
		refid = episode
		if (episode == 0) then title = 'Prologue'
		elseif (episode <= 5) then title = 'The Girl with a God\'s Name (' .. episode .. ')'
		elseif (episode <= 11) then title = 'The Queen and the Bum (' .. episode - 5 .. ')'
		elseif (episode <= 20) then title = 'The Sorrow of Loss (' .. episode - 11 .. ')'
		elseif (episode <= 26) then title = 'AAA Magician (' .. episode - 20 .. ')'
		elseif (episode <= 35) then title = 'The Golden Knight (' .. episode - 26 .. ')'
		elseif (episode <= 42) then title = 'Longing for Yesterday (' .. episode - 35 .. ')'
		elseif (episode <= 50) then title = 'Half (半) - ' .. episode - 42
		elseif (episode <= 57) then title = 'The Wavering King (' .. episode - 50 .. ')'
		elseif (episode <= 63) then title = 'Rival (' .. episode - 57 .. ')'
		elseif (episode <= 83) then title = 'The Night it Rained Fire (' .. episode - 63 .. ')'
		elseif (episode <= 88) then title = 'The Power of the Name (' .. episode - 83 .. ')'
		elseif (episode <= 100) then title = 'Lies for You ('.. episode - 88 .. ')'
		end
	elseif (season == '2') then
		refid = '2-' .. episode
		if (episode == 0) then title = 'Season 2 Prologue'
		elseif (episode <= 5) then title = 'Lost (' .. episode .. ')'
		elseif (episode <= 12) then title = 'Blood (' .. episode - 5 .. ')'
		elseif (episode <= 20) then title = 'The Weapon of a God (' .. episode - 12 .. ')'
		elseif (episode <= 26) then title = 'The Border (' .. episode - 20 .. ')'
		elseif (episode <= 33) then title = 'Reflection (' .. episode - 26 .. ')'
		elseif (episode <= 40) then title = 'The Test of the Sword (' .. episode - 33 .. ')'
		elseif (episode <= 50) then title = 'Rift (' .. episode - 40 .. ')'
		elseif (episode <= 57) then title = 'Enmity (' .. episode - 50 .. ')'
		elseif (episode <= 70) then title = 'Frozen Tears (' .. episode - 57 .. ')'
		elseif (episode <= 80) then title = 'The One to Stand Before Me (' .. episode - 70 .. ')'
		elseif (episode <= 88) then title = 'The Good (' .. episode - 80 .. ')'
		elseif (episode <= 95) then title = 'Taboo (' .. episode - 88 .. ')'
		elseif (episode <= 100) then title = 'That Which Cannot be Grasped or Held (' .. episode - 95 .. ')'
		elseif (episode <= 106) then title = 'Outsider (' .. episode - 100 .. ')'
		elseif (episode <= 112) then title = 'Last Stand (' .. episode - 106 .. ')'
		elseif (episode <= 200) then title = 'Emergency (' .. episode - 112 .. ')'
		end
	end
	return frame:preprocess('<ref name="ch' .. refid .. '">[[Chapter ' .. refid .. '|Season ' .. season .. ' Chapter ' .. episode .. ': ' .. title .. ']]</ref>')
end
 
return p
Advertisement