Documentation for this module may be created at Module:ChapterLink/doc
-- This module was taken and adapted from the Kubera Wiki
--
--
--
-- This module needs to be updated every Tuesday when the new Naver chapter is released.
--
-- How webtoon numbering for Naver is calculated:
-- Prologue (Chapter 0): 1
-- Chapter 1-55: chapter # + 1
-- Chapter 56 onwards: chapter # + 2
-- Chapter 87 onwards: chapter # + 3
--
-- How webtoon numbering for LINE is calculated:
-- Prologue (Chapter 0): 1
-- Chapter 1 onwards: chapter # + 1
--
--
local p = {}
function p.GetNumber( frame )
local LATEST_NAVER = 233 -- Update this on Tuesdays - most recent chapter #
local LATEST_WEBTOONS = 231 -- Update this on Saturday - most recent chapter #
local site = frame.args[1]
local anchor = frame.args[2]
local chapter = frame.args[3]
local LinkNumber = 0
local LinkTxt = "Something went wrong."
-- Get the link number.
chapter = tonumber( chapter )
if not chapter then
return "No chapter specified!"
end
-- Return Naver link
if (site == "naver") then
if (anchor == "1") then
if (chapter <= 55) then LinkNumber = chapter + 1
elseif (chapter <= 86) then LinkNumber = chapter + 2
elseif (chapter <= 161) then LinkNumber = chapter + 3
else LinkNumber = chapter + 4
end
end
if (anchor == "1") or (chapter <= LATEST_NAVER) then
LinkTxt = "[http://comic.naver.com/webtoon/detail.nhn?titleId=662774&no=" .. LinkNumber .. " Naver] (Korean)"
else
LinkTxt = "Not yet available on [http://comic.naver.com/webtoon/list.nhn?titleId=662774 Naver] (Korean)"
end
-- Return LINE link
elseif (site == "line") then
if (anchor == "1") then
if (chapter <= 161) then LinkNumber = chapter + 1
else LinkNumber = chapter + 2
end
end
if (chapter <= LATEST_WEBTOONS) then
LinkTxt = "[http://webtoons.com/viewer?titleNo=1099&episodeNo=" .. LinkNumber .. " LINE] (English)"
else
LinkTxt = "Not yet available on [http://webtoons.com/episodeList?titleNo=1099 LINE] (English)"
end
end
return LinkTxt
end
return p
--[[Category:Lua modules]]